use sauron::html::lookup::match_tag; use sauron::vdom::Node; use sauron_html_parser::parse_html; #[test] fn should_match_tags() { assert_eq!(Some("div"), match_tag(&String::from("div"))); assert_eq!(Some("svg"), match_tag(&String::from("svg"))); assert_eq!( Some("color-profile"), match_tag(&String::from("color-profile")) ); } #[test] fn test_html_child() { let html = r#"
This is div content1
"#; let expected = "
\n This is div content1\n
"; let node: Node<()> = parse_html(html).ok().flatten().expect("must parse"); println!("node: {:#?}", node); println!("render: {}", node.render_to_string()); assert_eq!(expected, node.render_to_string()); } #[test] fn test_node_list() { let html = r#" This is body "#; let expected = "This is body"; let node: Node<()> = parse_html(html).ok().flatten().expect("must parse"); println!("node: {:#?}", node); println!("render: {}", node.render_to_string()); assert_eq!(expected, node.render_to_string()); }