refactor !important
tests into separate file
This commit is contained in:
parent
45508a7665
commit
9e2397ce8d
@ -289,6 +289,16 @@ test!(
|
|||||||
}",
|
}",
|
||||||
"a {\n color: a, b1;\n}\n"
|
"a {\n color: a, b1;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
color_plus_ident,
|
||||||
|
"a {\n color: red + foo;\n}\n",
|
||||||
|
"a {\n color: redfoo;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
ident_plus_color,
|
||||||
|
"a {\n color: foo + red;\n}\n",
|
||||||
|
"a {\n color: foored;\n}\n"
|
||||||
|
);
|
||||||
error!(
|
error!(
|
||||||
map_lhs_add,
|
map_lhs_add,
|
||||||
"a {color: (a: b) + 1;}", "Error: (a: b) isn't a valid CSS value."
|
"a {color: (a: b) + 1;}", "Error: (a: b) isn't a valid CSS value."
|
||||||
|
@ -192,46 +192,6 @@ test!(
|
|||||||
"a {\n color: hsla($hue: 193, $saturation: 67%, $lightness: 99, $alpha: .6);\n}\n",
|
"a {\n color: hsla($hue: 193, $saturation: 67%, $lightness: 99, $alpha: .6);\n}\n",
|
||||||
"a {\n color: rgba(251, 253, 254, 0.6);\n}\n"
|
"a {\n color: rgba(251, 253, 254, 0.6);\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
|
||||||
color_plus_ident,
|
|
||||||
"a {\n color: red + foo;\n}\n",
|
|
||||||
"a {\n color: redfoo;\n}\n"
|
|
||||||
);
|
|
||||||
test!(
|
|
||||||
ident_plus_color,
|
|
||||||
"a {\n color: foo + red;\n}\n",
|
|
||||||
"a {\n color: foored;\n}\n"
|
|
||||||
);
|
|
||||||
test!(
|
|
||||||
color_minus_ident,
|
|
||||||
"a {\n color: red - foo;\n}\n",
|
|
||||||
"a {\n color: red-foo;\n}\n"
|
|
||||||
);
|
|
||||||
test!(
|
|
||||||
color_minus_dbl_quote_ident,
|
|
||||||
"a {\n color: red - \"foo\";\n}\n",
|
|
||||||
"a {\n color: red-\"foo\";\n}\n"
|
|
||||||
);
|
|
||||||
test!(
|
|
||||||
color_minus_sgl_quote_ident,
|
|
||||||
"a {\n color: red - 'foo';\n}\n",
|
|
||||||
"a {\n color: red-\"foo\";\n}\n"
|
|
||||||
);
|
|
||||||
test!(
|
|
||||||
color_minus_important,
|
|
||||||
"a {\n color: red - !important;\n}\n",
|
|
||||||
"a {\n color: red-!important;\n}\n"
|
|
||||||
);
|
|
||||||
test!(
|
|
||||||
color_minus_null,
|
|
||||||
"a {\n color: red - null;\n}\n",
|
|
||||||
"a {\n color: red-;\n}\n"
|
|
||||||
);
|
|
||||||
test!(
|
|
||||||
ident_minus_color,
|
|
||||||
"a {\n color: foo - red;\n}\n",
|
|
||||||
"a {\n color: foo-red;\n}\n"
|
|
||||||
);
|
|
||||||
test!(
|
test!(
|
||||||
hue,
|
hue,
|
||||||
"a {\n color: hue(hsl(193, 67%, 28%));\n}\n",
|
"a {\n color: hue(hsl(193, 67%, 28%));\n}\n",
|
||||||
|
35
tests/important.rs
Normal file
35
tests/important.rs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#![cfg(test)]
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
mod macros;
|
||||||
|
|
||||||
|
test!(
|
||||||
|
keyword_important_lowercase,
|
||||||
|
"a {\n height: !important;\n}\n",
|
||||||
|
"a {\n height: !important;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
keyword_important_uppercase,
|
||||||
|
"a {\n height: !IMPORTANT;\n}\n",
|
||||||
|
"a {\n height: !important;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
keyword_important_at_start_of_list,
|
||||||
|
"a {\n height: !important 1 2 3;\n}\n",
|
||||||
|
"a {\n height: !important 1 2 3;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
keyword_important_at_end_of_list,
|
||||||
|
"a {\n height: 1 2 3 !important;\n}\n",
|
||||||
|
"a {\n height: 1 2 3 !important;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
keyword_important_inside_list,
|
||||||
|
"a {\n color: 1 2 !important 3 4;\n}\n",
|
||||||
|
"a {\n color: 1 2 !important 3 4;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
whitespace_after_exclamation,
|
||||||
|
"a {\n color: ! important;\n}\n",
|
||||||
|
"a {\n color: !important;\n}\n"
|
||||||
|
);
|
@ -12,16 +12,6 @@ test!(
|
|||||||
"a {\n foo: --webkit-bar-baz;\n}\n"
|
"a {\n foo: --webkit-bar-baz;\n}\n"
|
||||||
);
|
);
|
||||||
test!(ident_with_num, "el1 {\n a: b;\n}\n");
|
test!(ident_with_num, "el1 {\n a: b;\n}\n");
|
||||||
test!(keyword_important, "a {\n height: 1 !important;\n}\n");
|
|
||||||
test!(
|
|
||||||
keyword_important_uppercase,
|
|
||||||
"a {\n height: 1 !IMPORTANT;\n}\n",
|
|
||||||
"a {\n height: 1 !important;\n}\n"
|
|
||||||
);
|
|
||||||
test!(
|
|
||||||
keyword_important_not_at_end,
|
|
||||||
"a {\n height: !important 1;\n}\n"
|
|
||||||
);
|
|
||||||
test!(
|
test!(
|
||||||
emits_double_newline_between_unrelated_styles,
|
emits_double_newline_between_unrelated_styles,
|
||||||
"a {\n color: red;\n}\n\nb {\n color: blue;\n}\n"
|
"a {\n color: red;\n}\n\nb {\n color: blue;\n}\n"
|
||||||
@ -88,15 +78,6 @@ test!(
|
|||||||
"a {\n color: inspect((((((a))))));\n}\n",
|
"a {\n color: inspect((((((a))))));\n}\n",
|
||||||
"a {\n color: a;\n}\n"
|
"a {\n color: a;\n}\n"
|
||||||
);
|
);
|
||||||
test!(
|
|
||||||
allow_spaces_after_exclamation_point,
|
|
||||||
"a {\n color: foo ! important;\n}\n",
|
|
||||||
"a {\n color: foo !important;\n}\n"
|
|
||||||
);
|
|
||||||
test!(
|
|
||||||
values_after_important,
|
|
||||||
"a {\n color: foo bar !important hux baz;\n}\n"
|
|
||||||
);
|
|
||||||
test!(
|
test!(
|
||||||
no_space_between_colon_and_style_variable,
|
no_space_between_colon_and_style_variable,
|
||||||
"$base-color: #036;\na {\n color:lighten($base-color, 5%);\n}",
|
"$base-color: #036;\na {\n color:lighten($base-color, 5%);\n}",
|
||||||
|
@ -255,6 +255,36 @@ test!(
|
|||||||
}",
|
}",
|
||||||
"a {\n color: 1-a, b;\n}\n"
|
"a {\n color: 1-a, b;\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
color_minus_unquoted,
|
||||||
|
"a {\n color: red - foo;\n}\n",
|
||||||
|
"a {\n color: red-foo;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
color_minus_dblquoted,
|
||||||
|
"a {\n color: red - \"foo\";\n}\n",
|
||||||
|
"a {\n color: red-\"foo\";\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
color_minus_sglquoted,
|
||||||
|
"a {\n color: red - 'foo';\n}\n",
|
||||||
|
"a {\n color: red-\"foo\";\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
color_minus_important,
|
||||||
|
"a {\n color: red - !important;\n}\n",
|
||||||
|
"a {\n color: red-!important;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
color_minus_null,
|
||||||
|
"a {\n color: red - null;\n}\n",
|
||||||
|
"a {\n color: red-;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
ident_minus_color,
|
||||||
|
"a {\n color: foo - red;\n}\n",
|
||||||
|
"a {\n color: foo-red;\n}\n"
|
||||||
|
);
|
||||||
error!(
|
error!(
|
||||||
number_minus_color,
|
number_minus_color,
|
||||||
"a {\n color: 1 - #abc;\n}\n", "Error: Undefined operation \"1 - #abc\"."
|
"a {\n color: 1 - #abc;\n}\n", "Error: Undefined operation \"1 - #abc\"."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user