Skip to content

Commit 222f845

Browse files
[css-selector] Add tests for missed patterns
Found after running the `regex-coverage` npm script.
1 parent 8ace65b commit 222f845

File tree

1 file changed

+133
-0
lines changed

1 file changed

+133
-0
lines changed
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
.foo
2+
#bar
3+
:hover
4+
::before
5+
::selection
6+
> + ~ ||
7+
:nth-child(2n+1)
8+
:nth-child(even)
9+
[type="text" i]
10+
[data-lang|='en']
11+
[data-count=items]
12+
[svg|href$="icon" s]
13+
[attr*=value]
14+
[attr^="start"]
15+
[attr~=token]
16+
[attr|=lang]
17+
[attr=value s]
18+
19+
----------------------------------------------------
20+
21+
[
22+
["class", ".foo"],
23+
24+
["id", "#bar"],
25+
26+
["pseudo-class", ":hover"],
27+
28+
["pseudo-element", "::before"],
29+
30+
["pseudo-element", "::selection"],
31+
32+
["combinator", ">"],
33+
["combinator", "+"],
34+
["combinator", "~"],
35+
["combinator", "||"],
36+
37+
["pseudo-class", ":nth-child"],
38+
["punctuation", "("],
39+
["n-th", [
40+
["number", "2n"],
41+
["operator", "+"],
42+
["number", "1"]
43+
]],
44+
["punctuation", ")"],
45+
46+
["pseudo-class", ":nth-child"],
47+
["punctuation", "("],
48+
["n-th", "even"],
49+
["punctuation", ")"],
50+
51+
["attribute", [
52+
["punctuation", "["],
53+
["attr-name", "type"],
54+
["operator", "="],
55+
["attr-value", "\"text\""],
56+
["case-sensitivity", "i"],
57+
["punctuation", "]"]
58+
]],
59+
60+
["attribute", [
61+
["punctuation", "["],
62+
["attr-name", "data-lang"],
63+
["operator", "|="],
64+
["attr-value", "'en'"],
65+
["punctuation", "]"]
66+
]],
67+
68+
["attribute", [
69+
["punctuation", "["],
70+
["attr-name", "data-count"],
71+
["operator", "="],
72+
["attr-value", "items"],
73+
["punctuation", "]"]
74+
]],
75+
76+
["attribute", [
77+
["punctuation", "["],
78+
["namespace", [
79+
"svg",
80+
["punctuation", "|"]
81+
]],
82+
["attr-name", "href"],
83+
["operator", "$="],
84+
["attr-value", "\"icon\""],
85+
["case-sensitivity", "s"],
86+
["punctuation", "]"]
87+
]],
88+
89+
["attribute", [
90+
["punctuation", "["],
91+
["attr-name", "attr"],
92+
["operator", "*="],
93+
["attr-value", "value"],
94+
["punctuation", "]"]
95+
]],
96+
97+
["attribute", [
98+
["punctuation", "["],
99+
["attr-name", "attr"],
100+
["operator", "^="],
101+
["attr-value", "\"start\""],
102+
["punctuation", "]"]
103+
]],
104+
105+
["attribute", [
106+
["punctuation", "["],
107+
["attr-name", "attr"],
108+
["operator", "~="],
109+
["attr-value", "token"],
110+
["punctuation", "]"]
111+
]],
112+
113+
["attribute", [
114+
["punctuation", "["],
115+
["attr-name", "attr"],
116+
["operator", "|="],
117+
["attr-value", "lang"],
118+
["punctuation", "]"]
119+
]],
120+
121+
["attribute", [
122+
["punctuation", "["],
123+
["attr-name", "attr"],
124+
["operator", "="],
125+
["attr-value", "value"],
126+
["case-sensitivity", "s"],
127+
["punctuation", "]"]
128+
]]
129+
]
130+
131+
----------------------------------------------------
132+
133+
Test the core css-selector token types.

0 commit comments

Comments
 (0)