implement number minus ident

This commit is contained in:
ConnorSkees 2020-03-31 01:52:52 -04:00
parent 90b940fd7d
commit 8a600a4f07
2 changed files with 18 additions and 0 deletions

View File

@ -120,6 +120,9 @@ impl Sub for Value {
Self::List(..) => { Self::List(..) => {
Value::Ident(format!("{}{}-{}", num, unit, other), QuoteKind::None) Value::Ident(format!("{}{}-{}", num, unit, other), QuoteKind::None)
} }
Self::Ident(..) => {
Value::Ident(format!("{}{}-{}", num, unit, other), QuoteKind::None)
}
_ => todo!(), _ => todo!(),
}, },
Self::Color(c) => match other { Self::Color(c) => match other {

View File

@ -153,3 +153,18 @@ test!(
"a {\n color: 'foo' - 1px;\n}\n", "a {\n color: 'foo' - 1px;\n}\n",
"a {\n color: \"foo\"-1px;\n}\n" "a {\n color: \"foo\"-1px;\n}\n"
); );
test!(
number_minus_unquoted_ident,
"a {\n color: 1 - foo;\n}\n",
"a {\n color: 1-foo;\n}\n"
);
test!(
number_minus_sglquoted_ident,
"a {\n color: 1 - 'foo';\n}\n",
"a {\n color: 1-\"foo\";\n}\n"
);
test!(
number_minus_dblquoted_ident,
"a {\n color: 1 - \"foo\";\n}\n",
"a {\n color: 1-\"foo\";\n}\n"
);