Skip to content

Commit dd0af79

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

File tree

1 file changed

+154
-0
lines changed

1 file changed

+154
-0
lines changed
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
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+
ul#menu > li.item:not(:first-child) + li[data-role="cta"]::before
19+
20+
----------------------------------------------------
21+
22+
[
23+
["class", ".foo"],
24+
25+
["id", "#bar"],
26+
27+
["pseudo-class", ":hover"],
28+
29+
["pseudo-element", "::before"],
30+
31+
["pseudo-element", "::selection"],
32+
33+
["combinator", ">"],
34+
["combinator", "+"],
35+
["combinator", "~"],
36+
["combinator", "||"],
37+
38+
["pseudo-class", ":nth-child"],
39+
["punctuation", "("],
40+
["n-th", [
41+
["number", "2n"],
42+
["operator", "+"],
43+
["number", "1"]
44+
]],
45+
["punctuation", ")"],
46+
47+
["pseudo-class", ":nth-child"],
48+
["punctuation", "("],
49+
["n-th", "even"],
50+
["punctuation", ")"],
51+
52+
["attribute", [
53+
["punctuation", "["],
54+
["attr-name", "type"],
55+
["operator", "="],
56+
["attr-value", "\"text\""],
57+
["case-sensitivity", "i"],
58+
["punctuation", "]"]
59+
]],
60+
61+
["attribute", [
62+
["punctuation", "["],
63+
["attr-name", "data-lang"],
64+
["operator", "|="],
65+
["attr-value", "'en'"],
66+
["punctuation", "]"]
67+
]],
68+
69+
["attribute", [
70+
["punctuation", "["],
71+
["attr-name", "data-count"],
72+
["operator", "="],
73+
["attr-value", "items"],
74+
["punctuation", "]"]
75+
]],
76+
77+
["attribute", [
78+
["punctuation", "["],
79+
["namespace", [
80+
"svg",
81+
["punctuation", "|"]
82+
]],
83+
["attr-name", "href"],
84+
["operator", "$="],
85+
["attr-value", "\"icon\""],
86+
["case-sensitivity", "s"],
87+
["punctuation", "]"]
88+
]],
89+
90+
["attribute", [
91+
["punctuation", "["],
92+
["attr-name", "attr"],
93+
["operator", "*="],
94+
["attr-value", "value"],
95+
["punctuation", "]"]
96+
]],
97+
98+
["attribute", [
99+
["punctuation", "["],
100+
["attr-name", "attr"],
101+
["operator", "^="],
102+
["attr-value", "\"start\""],
103+
["punctuation", "]"]
104+
]],
105+
106+
["attribute", [
107+
["punctuation", "["],
108+
["attr-name", "attr"],
109+
["operator", "~="],
110+
["attr-value", "token"],
111+
["punctuation", "]"]
112+
]],
113+
114+
["attribute", [
115+
["punctuation", "["],
116+
["attr-name", "attr"],
117+
["operator", "|="],
118+
["attr-value", "lang"],
119+
["punctuation", "]"]
120+
]],
121+
122+
["attribute", [
123+
["punctuation", "["],
124+
["attr-name", "attr"],
125+
["operator", "="],
126+
["attr-value", "value"],
127+
["case-sensitivity", "s"],
128+
["punctuation", "]"]
129+
]],
130+
131+
"\r\nul",
132+
["id", "#menu"],
133+
["combinator", ">"],
134+
" li",
135+
["class", ".item"],
136+
["pseudo-class", ":not"],
137+
["punctuation", "("],
138+
["pseudo-class", ":first-child"],
139+
["punctuation", ")"],
140+
["combinator", "+"],
141+
" li",
142+
["attribute", [
143+
["punctuation", "["],
144+
["attr-name", "data-role"],
145+
["operator", "="],
146+
["attr-value", "\"cta\""],
147+
["punctuation", "]"]
148+
]],
149+
["pseudo-element", "::before"]
150+
]
151+
152+
----------------------------------------------------
153+
154+
Test the core css-selector token types.

0 commit comments

Comments
 (0)