#[test]
fn test_complicated_attributes() {
let _ = env_logger::builder().is_test(true).try_init();
let sheet = stylist::ast::sheet! {
border: medium dashed green;
&:checked + label {
color: #9799a7;
}
&:nth-child(-n+4) ~ nav {
max-height: 500px;
}
::first-letter {
box-shadow: 3px 3px red, -1rem 0 0.4rem olive;
}
article span {
box-shadow: inset 0 1px 2px rgba(0.32, 0, 0, 15%);
}
a[href*="login"],
a[href^="https://"],
a[rel~="tag"],
a[lang|="en"]
{
background-image: url("images/pdf.png");
}
#content::after {
content: " (" attr(x) ")";
}
};
log::debug!("{:?}", sheet);
let style = stylist::Style::new(sheet).unwrap();
let expected_result = format!(
r#".{cls} {{
border: medium dashed green;
}}
.{cls}:checked+label {{
color: #9799a7;
}}
.{cls}:nth-child(-n+4)~nav {{
max-height: 500px;
}}
.{cls}::first-letter {{
box-shadow: 3px 3px red,-1rem 0 0.4rem olive;
}}
.{cls} article span {{
box-shadow: inset 0 1px 2px rgba(0.32,0,0,15%);
}}
.{cls} a[href *="login"], .{cls} a[href^="https://"], .{cls} a[rel~="tag"], .{cls} a[lang|="en"] {{
background-image: url("images/pdf.png");
}}
.{cls} #content::after {{
content: " (" attr(x) ")";
}}
"#,
cls = style.get_class_name()
);
assert_eq!(expected_result, style.get_style_str());
}