use node_html_parser::{parse_with_options, Options};
#[test]
fn void_tag_closing_slash_serialization() {
let mut opts = Options::default();
opts.void_tag.add_closing_slash = true; let root = parse_with_options(
"<br><img src=\"a b\" class=space><div id=\"x\" data=\"v\"></div>",
&opts,
);
let html = root.inner_html();
assert!(html.contains("<br/>"), "expected <br/> got {html}");
assert!(
html.contains("<img src=\"a b\" class=\"space\" />"),
"img serialization mismatch: {html}"
);
}
#[test]
fn attribute_quoting_like_js() {
let opts = Options::default();
let root = parse_with_options("<div id=\"a\"></div>", &opts);
let el = root.query_selector("div").unwrap();
let mut cloned = el.clone();
cloned.set_attribute("data", "line1\nline2\t\"q\"");
let out = cloned.outer_html();
let expected_value = format!("line1\nline2\t{}", ""q"");
assert!(
out.contains(&format!("data=\"{}\"", expected_value)),
"quoting mismatch: {out}"
);
}