Add tests for nested rulesets in mixins

This commit is contained in:
ConnorSkees 2020-01-17 16:14:19 -05:00
parent b05301f442
commit 364480dc6f

View File

@ -711,9 +711,9 @@ fn main() -> SassResult<()> {
let mut stdout = std::io::BufWriter::new(std::io::stdout());
let s = StyleSheet::from_path("input.scss")?;
// dbg!(s);
s.pretty_print(&mut stdout)?;
// s.pretty_print(&mut stdout)?;
// s.pretty_print_selectors(&mut stdout)?;
// s.print_as_css(&mut stdout)?;
s.print_as_css(&mut stdout)?;
// dbg!(Css::from_stylesheet(s));
// println!("{}", s);
// drop(input);
@ -1163,4 +1163,19 @@ mod css_mixins {
"@mixin a {\n b {\n color: red;\n }\n c {\n color: blue;\n }\n}\nd {\n @include a;\n}\n",
"d b {\n color: red;\n}\nd c {\n color: blue;\n}\n"
);
test!(
mixin_ruleset_and_style,
"@mixin a {\n b {\n color: red;\n }\n color: blue;\n}\nd {\n @include a;\n}\n",
"d {\n color: blue;\n}\nd b {\n color: red;\n}\n"
);
test!(
mixin_style_and_ruleset,
"@mixin a {\n color: blue;\n b {\n color: red;\n}\n}\nd {\n @include a;\n}\n",
"d {\n color: blue;\n}\nd b {\n color: red;\n}\n"
);
test!(
mixin_nested_rulesets,
"@mixin a {\n b {\n c {\n color: red;\n}\n}\n}\nd {\n @include a;\n}\n",
"d b c {\n color: red;\n}\n"
);
}