2020-04-06 00:44:12 -04:00
|
|
|
#![cfg(test)]
|
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
mod macros;
|
|
|
|
|
|
|
|
test!(
|
|
|
|
simple_nested,
|
2020-04-06 00:51:12 -04:00
|
|
|
".foo {\n @at-root {\n .bar {a: b}\n }\n}\n",
|
2020-04-06 00:44:12 -04:00
|
|
|
".bar {\n a: b;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
with_selector,
|
2020-04-06 00:51:12 -04:00
|
|
|
".foo {\n @at-root .bar {a: b}\n}\n",
|
2020-04-06 00:44:12 -04:00
|
|
|
".bar {\n a: b;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
with_selector_in_mixin,
|
2020-04-06 00:51:12 -04:00
|
|
|
"@mixin bar {\n @at-root .bar {a: b}\n}\n\n.foo {\n @include bar;\n}\n",
|
2020-04-06 00:44:12 -04:00
|
|
|
".bar {\n a: b;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
with_super_selector,
|
2020-04-06 00:51:12 -04:00
|
|
|
".foo {\n @at-root & {\n a: b;\n }\n}\n",
|
2020-04-06 00:44:12 -04:00
|
|
|
".foo {\n a: b;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
nested_with_super_selector,
|
2020-04-06 00:51:12 -04:00
|
|
|
".foo {\n @at-root & {\n .bar {\n @at-root & {\n a: b;\n }\n }\n }\n}\n",
|
2020-04-06 00:44:12 -04:00
|
|
|
".foo .bar {\n a: b;\n}\n"
|
|
|
|
);
|
2020-04-06 13:13:03 -04:00
|
|
|
test!(
|
|
|
|
deeply_nested_with_rulesets_and_styles,
|
|
|
|
".foo {\n @at-root .bar {\n a: b;\n c {\n d: e;\n foo {\n bar: baz;\n }\n h: j;\n }\n f: g;\n }\n}\n",
|
|
|
|
".bar {\n a: b;\n f: g;\n}\n.bar c {\n d: e;\n h: j;\n}\n.bar c foo {\n bar: baz;\n}\n"
|
|
|
|
);
|
2020-04-06 13:30:36 -04:00
|
|
|
test!(
|
|
|
|
super_selector_inside_with_nothing,
|
|
|
|
"foo {\n @at-root {\n & {\n color: bar;\n }\n }\n}\n",
|
|
|
|
"foo {\n color: bar;\n}\n"
|
|
|
|
);
|
2020-04-06 14:30:36 -04:00
|
|
|
test!(
|
|
|
|
interpolated_super_selector_with_nothing,
|
|
|
|
"test {\n @at-root {\n #{&}post {\n foo {\n bar: baz;\n }\n }\n }\n}\n",
|
|
|
|
"testpost foo {\n bar: baz;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
with_ampersand_single,
|
|
|
|
"test {\n @at-root {\n #{&}post {\n foo {\n bar: baz;\n }\n }\n }\n}\n",
|
|
|
|
"testpost foo {\n bar: baz;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
root_interpolated_ampersand,
|
|
|
|
"@at-root {\n #{&}post {\n foo {\n bar: baz;\n }\n }\n}\n",
|
|
|
|
"post foo {\n bar: baz;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
nested_prefix_interpolated_ampersand,
|
|
|
|
"test {\n @at-root {\n pre#{&} {\n foo {\n bar: baz;\n }\n }\n }\n}\n",
|
|
|
|
"pretest foo {\n bar: baz;\n}\n"
|
|
|
|
);
|
|
|
|
test!(
|
|
|
|
nested_alone_interpolated_ampersand,
|
|
|
|
"test {\n @at-root {\n #{&} {\n foo {\n bar: baz;\n }\n }\n }\n}\n",
|
|
|
|
"test foo {\n bar: baz;\n}\n"
|
|
|
|
);
|
2020-06-16 22:00:45 -04:00
|
|
|
test!(
|
|
|
|
style_before_at_root,
|
|
|
|
"a {}\n\n@at-root {\n @-ms-viewport { width: device-width; }\n}\n",
|
|
|
|
"@-ms-viewport {\n width: device-width;\n}\n"
|
2020-06-17 02:02:05 -04:00
|
|
|
);
|
2020-06-18 03:09:24 -04:00
|
|
|
error!(
|
|
|
|
missing_closing_curly_brace,
|
|
|
|
"@at-root {", "Error: expected \"}\"."
|
|
|
|
);
|