From 54dec82cb8620937306e9a16b4b532cb52c7ee55 Mon Sep 17 00:00:00 2001 From: gennyble Date: Wed, 27 Dec 2023 16:22:02 -0600 Subject: parse external scripts --- src/lib.rs | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 55eba4b..26ec5dd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -67,7 +67,9 @@ impl Html { loop { // Special case \n"; + + let hh = Html::parse(raw); + assert_eq!( + hh.nodes, + vec![tag!( + "head", + [ + text!("\n\t"), + tag!("script", [text!("let k=\"v\";\n\t")]), + text!("\n") + ] + )] + ) + } + + #[test] + fn parse_external_script() { + let raw = "\n\t\n"; + + let hh = Html::parse(raw); + assert_eq!( + hh.nodes, + vec![tag!( + "head", + [ + text!("\n\t"), + tag!("script", "src=\"script.js\""), + text!("\n") + ] + )] + ) + } } #[cfg(test)] -- cgit 1.4.1-3-g733a5