use html_editor::operation::*; use html_editor::{parse, try_parse}; #[test] fn paired_tag() { parse("

").unwrap(); parse("
Hello, world!
").unwrap(); } #[test] fn void_tag() { parse("
").unwrap(); parse("
").unwrap(); } #[test] fn self_closing_tag() { parse("").unwrap(); } #[test] fn comment_tag() { parse("").unwrap(); parse("").unwrap(); } #[test] fn attributes() { parse("example").unwrap(); parse("").unwrap(); } #[test] fn matched() { let a = parse( r#" "#, ) .unwrap() .trim() .html(); let b = parse( r#" "#, ) .unwrap() .trim() .html(); let c = parse( r#" "#, ) .unwrap() .trim() .html(); assert_eq!("", a); assert_eq!("", b); assert_eq!("", c); } #[test] fn complex() { let mut dom = parse( r#" ">
"#, ) .unwrap(); dom.trim(); } #[test] fn fault_tolerance() { assert_eq!( try_parse(r#"
Ipsum"#).html(), "
Ipsum
" ); assert_eq!(try_parse(r#"
Ipsum"#).html(), "
Ipsum
"); assert_eq!( try_parse(r#"Ipsum"#).html(), "Ipsum" ); } #[test] fn autocomplete_multiple_unclosed_tags() { assert_eq!( try_parse(r#"

"#).html(), "

" ); } #[test] fn xml() { let mut html = parse( r#" Hello World "#, ) .unwrap(); html.trim(); }