add remaining selector-unify tests
This commit is contained in:
parent
402d7bf8e6
commit
84328f0e2c
@ -418,9 +418,7 @@ pub(crate) struct Pseudo {
|
|||||||
impl PartialEq for Pseudo {
|
impl PartialEq for Pseudo {
|
||||||
fn eq(&self, other: &Pseudo) -> bool {
|
fn eq(&self, other: &Pseudo) -> bool {
|
||||||
self.name == other.name
|
self.name == other.name
|
||||||
&& self.normalized_name == other.normalized_name
|
|
||||||
&& self.is_class == other.is_class
|
&& self.is_class == other.is_class
|
||||||
&& self.is_syntactic_class == other.is_syntactic_class
|
|
||||||
&& self.argument == other.argument
|
&& self.argument == other.argument
|
||||||
&& self.selector == other.selector
|
&& self.selector == other.selector
|
||||||
}
|
}
|
||||||
@ -431,9 +429,7 @@ impl Eq for Pseudo {}
|
|||||||
impl Hash for Pseudo {
|
impl Hash for Pseudo {
|
||||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||||
self.name.hash(state);
|
self.name.hash(state);
|
||||||
self.normalized_name.hash(state);
|
|
||||||
self.is_class.hash(state);
|
self.is_class.hash(state);
|
||||||
self.is_syntactic_class.hash(state);
|
|
||||||
self.argument.hash(state);
|
self.argument.hash(state);
|
||||||
self.selector.hash(state);
|
self.selector.hash(state);
|
||||||
}
|
}
|
||||||
|
@ -600,3 +600,73 @@ error!(
|
|||||||
"a {\n color: selector-unify(\"c\", 1);\n}\n",
|
"a {\n color: selector-unify(\"c\", 1);\n}\n",
|
||||||
"Error: $selector2: 1 is not a valid selector: it must be a string, a list of strings, or a list of lists of strings."
|
"Error: $selector2: 1 is not a valid selector: it must be a string, a list of strings, or a list of lists of strings."
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_no_arg_class_same,
|
||||||
|
"a {\n color: selector-unify(\":c\", \":c\");\n}\n",
|
||||||
|
"a {\n color: :c;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_no_arg_class_different,
|
||||||
|
"a {\n color: selector-unify(\":c\", \":d\");\n}\n",
|
||||||
|
"a {\n color: :c:d;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_no_arg_element_same,
|
||||||
|
"a {\n color: selector-unify(\"::c\", \"::c\");\n}\n",
|
||||||
|
"a {\n color: ::c;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_no_arg_element_different,
|
||||||
|
"a {\n color: inspect(selector-unify(\"::c\", \"::d\"));\n}\n",
|
||||||
|
"a {\n color: null;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_no_arg_element_and_class_same_before,
|
||||||
|
"a {\n color: selector-unify(\":before\", \"::before\");\n}\n",
|
||||||
|
"a {\n color: :before;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_no_arg_element_and_class_same_after,
|
||||||
|
"a {\n color: selector-unify(\":after\", \"::after\");\n}\n",
|
||||||
|
"a {\n color: :after;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_no_arg_element_and_class_same_first_line,
|
||||||
|
"a {\n color: selector-unify(\":first-line\", \"::first-line\");\n}\n",
|
||||||
|
"a {\n color: :first-line;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_no_arg_element_and_class_same_first_letter,
|
||||||
|
"a {\n color: selector-unify(\":first-letter\", \"::first-letter\");\n}\n",
|
||||||
|
"a {\n color: :first-letter;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_arg_class_same,
|
||||||
|
"a {\n color: selector-unify(\":c(@#$)\", \":c(@#$)\");\n}\n",
|
||||||
|
"a {\n color: :c(@#$);\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_arg_class_different_arg,
|
||||||
|
"a {\n color: selector-unify(\":c(@#$)\", \":c(*&^)\");\n}\n",
|
||||||
|
"a {\n color: :c(@#$):c(*&^);\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_arg_element_same,
|
||||||
|
"a {\n color: selector-unify(\"::c(@#$)\", \"::c(@#$)\");\n}\n",
|
||||||
|
"a {\n color: ::c(@#$);\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_arg_element_different_arg,
|
||||||
|
"a {\n color: inspect(selector-unify(\"::c(@#$)\", \"::c(*&^)\"));\n}\n",
|
||||||
|
"a {\n color: null;\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_arg_matches_same_selector_arg,
|
||||||
|
"a {\n color: selector-unify(\":matches(.c)\", \":matches(.c)\");\n}\n",
|
||||||
|
"a {\n color: :matches(.c);\n}\n"
|
||||||
|
);
|
||||||
|
test!(
|
||||||
|
simple_pseudo_arg_matches_different_selector_arg,
|
||||||
|
"a {\n color: selector-unify(\":matches(.c)\", \":matches(.d)\");\n}\n",
|
||||||
|
"a {\n color: :matches(.c):matches(.d);\n}\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user