use htmlificator::Element; #[test] fn self_closing () { let el = Element::new("H1", true); assert_eq!(format!("{}", el), "

") } #[test] fn non_self_closing () { let el = Element::new("Div", false); assert_eq!(format!("{}", el), "
\n
") } #[test] fn comment () { let mut el = Element::new("Div", false); el.add_comment("A Comment"); assert_eq!(format!("{}", el), "
\n <-- A Comment -->\n
") } #[test] fn child () { let mut el = Element::new("Div", false); let mut h1 = Element::new("H1", false); h1.add_text("Text"); el.add_element(h1); assert_eq!(format!("{}", el), "
\n

\n Text\n

\n
") }