MCPcopy Create free account
hub / github.com/Stranger6667/css-inline / test_collect_styles

Function test_collect_styles

css-inline/src/html/document.rs:495–511  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

493
494 #[test]
495 fn test_collect_styles() {
496 let doc = Document::parse_with_options(
497 r"
498<head>
499 <style>h1 { color:blue; }</style>
500 <style>h1 { color:red }</style>
501 <style data-css-inline='ignore'>h1 { color:yellow; }</style>
502</head>"
503 .as_bytes(),
504 0,
505 InliningMode::Document,
506 );
507 let styles = doc.styles().map(|(_, content)| content).collect::<Vec<_>>();
508 assert_eq!(styles.len(), 2);
509 assert_eq!(styles[0], "h1 { color:blue; }");
510 assert_eq!(styles[1], "h1 { color:red }");
511 }
512
513 #[test]
514 fn test_collect_stylesheets() {

Callers

nothing calls this directly

Calls 3

parse_with_optionsFunction · 0.85
as_bytesMethod · 0.80
stylesMethod · 0.80

Tested by

no test coverage detected