Correctly print whitespace when no params in at rule
This commit is contained in:
parent
260b357bba
commit
bf0ce2fe1a
@ -134,7 +134,11 @@ impl Css {
|
||||
}
|
||||
Toplevel::AtRule(r) => match r {
|
||||
AtRule::Unknown(u) => {
|
||||
if u.params.is_empty() {
|
||||
writeln!(buf, "{}@{} {{", padding, u.name)?;
|
||||
} else {
|
||||
writeln!(buf, "{}@{} {} {{", padding, u.name, u.params)?;
|
||||
}
|
||||
Css::from_stylesheet(StyleSheet::from_stmts(u.body.clone()))
|
||||
.pretty_print(buf, nesting + 1)
|
||||
.unwrap();
|
||||
|
@ -7,6 +7,10 @@ test!(
|
||||
basic_toplevel,
|
||||
"@media foo {\n a {\n color: red;\n }\n}\n"
|
||||
);
|
||||
test!(
|
||||
toplevel_no_params,
|
||||
"@media {\n a {\n color: red;\n }\n}\n"
|
||||
);
|
||||
test!(
|
||||
basic_nested,
|
||||
"a {\n @media foo {\n color: red;\n }\n}\n",
|
||||
|
Loading…
x
Reference in New Issue
Block a user