use node_html_parser::{parse_with_options, Options};
#[test]
fn issue_69_large_embed_iframe_roundtrip() {
let html = r#"<!DOCTYPE html>
<html>
<head><title>Embed/Iframe Sample</title></head>
<body>
<div class="wrap">
<embed width="1014" height="282" src="../../fzlm/top_falsh/201901/W020190119606990532110.swf" quality="high" type="application/x-shockwave-flash" />
<iframe src="https://example.com" width="600" height="400"></iframe>
</div>
</body>
</html>"#;
let mut opts = Options::default();
opts.comment = true; let root = parse_with_options(html, &opts);
let serialized = root.to_string();
let embed_sig = "<embed width=\"1014\" height=\"282\" src=\"../../fzlm/top_falsh/201901/W020190119606990532110.swf\"";
assert!(html.contains(embed_sig), "原始片段中应包含 embed 标签签名");
assert!(
serialized.contains(embed_sig),
"序列化后仍应保留 embed 关键属性串"
);
assert!(
!serialized.contains("</embed>"),
"void 元素 embed 不应出现闭合标签"
);
let orig_count = html.matches("<embed ").count();
let ser_count = serialized.matches("<embed ").count();
assert_eq!(orig_count, 1, "原始应只有一个 embed");
assert_eq!(ser_count, 1, "序列化后应只有一个 embed");
}