diff --git a/src/value/parse.rs b/src/value/parse.rs index 62618b7..f5e0928 100644 --- a/src/value/parse.rs +++ b/src/value/parse.rs @@ -123,7 +123,13 @@ impl Value { Ok(x) => x, Err(_) => return Ok(left), }; - Ok(Value::List(vec![left, right], ListSeparator::Space)) + if let Value::List(v, ListSeparator::Space) = right { + let mut v2 = vec![left]; + v2.extend(v); + Ok(Value::List(v2, ListSeparator::Space)) + } else { + Ok(Value::List(vec![left, right], ListSeparator::Space)) + } } } } diff --git a/tests/color.rs b/tests/color.rs index 14894fc..e57f7f3 100644 --- a/tests/color.rs +++ b/tests/color.rs @@ -86,13 +86,11 @@ test!( opacity_function_number_unit, "a {\n color: opacity(1px);\n}\n" ); -// blocked on better value parsing -// specifically, this is parsed as a number and a list -// test!( -// rgba_one_arg, -// "a {\n color: rgba(1 2 3);\n}\n", -// "a {\n color: #010203;\n}\n" -// ); +test!( + rgba_one_arg, + "a {\n color: rgba(1 2 3);\n}\n", + "a {\n color: #010203;\n}\n" +); test!( rgb_two_args, "a {\n color: rgb(#123, 0);\n}\n", diff --git a/tests/meta.rs b/tests/meta.rs index 0c3678f..4a98dc2 100644 --- a/tests/meta.rs +++ b/tests/meta.rs @@ -129,11 +129,11 @@ test!( "a {\n color: type-of(red)\n}\n", "a {\n color: color;\n}\n" ); -// test!( -// type_of_spaced_list, -// "a {\n color: type-of(1 2 3)\n}\n", -// "a {\n color: list;\n}\n" -// ); +test!( + type_of_spaced_list, + "a {\n color: type-of(1 2 3)\n}\n", + "a {\n color: list;\n}\n" +); test!( type_of_true, "a {\n color: type-of(true)\n}\n", @@ -274,11 +274,11 @@ test!( // "a {\n color: inspect(())\n}\n", // "a {\n color: ();\n}\n" // ); -// test!( -// inspect_spaced_list, -// "a {\n color: inspect(1 2 3)\n}\n", -// "a {\n color: 1 2 3;\n}\n" -// ); +test!( + inspect_spaced_list, + "a {\n color: inspect(1 2 3)\n}\n", + "a {\n color: 1 2 3;\n}\n" +); // test!( // inspect_comma_list, // "a {\n color: inspect(1, 2, 3)\n}\n", diff --git a/tests/mixins.rs b/tests/mixins.rs index 40a6ee5..7dec5d8 100644 --- a/tests/mixins.rs +++ b/tests/mixins.rs @@ -169,3 +169,8 @@ test!( "@mixin a {\n a {\n color: red;\n }\n}\n\n@include a;\n", "a {\n color: red;\n}\n" ); +test!( + include_list, + "@mixin foo($x) {\n color: $x;\n}\na {\n @include foo(0px 0px 0px 0px #ef8086 inset !important);\n}\n", + "a {\n color: 0px 0px 0px 0px #ef8086 inset !important;\n}\n" +); diff --git a/tests/values.rs b/tests/values.rs index 5956b61..0a8403b 100644 --- a/tests/values.rs +++ b/tests/values.rs @@ -463,3 +463,13 @@ test!( "a {\n color: (a b) - (1 2);\n}\n", "a {\n color: a b-1 2;\n}\n" ); +test!( + length_of_list_as_var, + "$a: 1 2 3 4 5;a {\n color: length($a);\n}\n", + "a {\n color: 5;\n}\n" +); +test!( + length_of_list, + "a {\n color: length(1 2 3 4 5);\n}\n", + "a {\n color: 5;\n}\n" +);