@@ -78,35 +78,6 @@ describe('css parser', () => {
7878 expect ( errors [ 0 ] . filename ) . toEqual ( 'foo.css' ) ;
7979 } ) ;
8080
81- it ( 'should parse selector with comma nested inside ()' , ( ) => {
82- const result = parse (
83- '[_nghost-ng-c4172599085]:not(.fit-content).aim-select:hover:not(:disabled, [_nghost-ng-c4172599085]:not(.fit-content).aim-select--disabled, [_nghost-ng-c4172599085]:not(.fit-content).aim-select--invalid, [_nghost-ng-c4172599085]:not(.fit-content).aim-select--active) { border-color: rgb(84, 84, 84); }' ,
84- ) ;
85-
86- expect ( result . parent ) . toEqual ( null ) ;
87-
88- const rules = result . stylesheet ! . rules ;
89- expect ( rules . length ) . toEqual ( 1 ) ;
90-
91- let rule = rules [ 0 ] as Rule ;
92- expect ( rule . parent ) . toEqual ( result ) ;
93- expect ( rule . selectors ?. length ) . toEqual ( 1 ) ;
94-
95- let decl = rule . declarations ! [ 0 ] ;
96- expect ( decl . parent ) . toEqual ( rule ) ;
97- } ) ;
98-
99- it ( 'parses { and } in attribute selectors correctly' , ( ) => {
100- const result = parse ( 'foo[someAttr~="{someId}"] { color: red; }' ) ;
101- const rules = result . stylesheet ! . rules ;
102-
103- expect ( rules . length ) . toEqual ( 1 ) ;
104-
105- const rule = rules [ 0 ] as Rule ;
106-
107- expect ( rule . selectors ! [ 0 ] ) . toEqual ( 'foo[someAttr~="{someId}"]' ) ;
108- } ) ;
109-
11081 it ( 'should set parent property' , ( ) => {
11182 const result = parse (
11283 'thing { test: value; }\n' +
@@ -148,50 +119,6 @@ describe('css parser', () => {
148119 expect ( out3 ) . toEqual ( '[data-aa\\:other] { color: red; }' ) ;
149120 } ) ;
150121
151- it ( 'parses nested commas in selectors correctly' , ( ) => {
152- const result = parse (
153- `
154- body > ul :is(li:not(:first-of-type) a:hover, li:not(:first-of-type).active a) {
155- background: red;
156- }
157- ` ,
158- ) ;
159- expect ( ( result . stylesheet ! . rules [ 0 ] as Rule ) ! . selectors ! . length ) . toEqual ( 1 ) ;
160-
161- const trickresult = parse (
162- `
163- li[attr="weirdly("] a:hover, li[attr="weirdly)"] a {
164- background-color: red;
165- }
166- ` ,
167- ) ;
168- expect (
169- ( trickresult . stylesheet ! . rules [ 0 ] as Rule ) ! . selectors ! . length ,
170- ) . toEqual ( 2 ) ;
171-
172- const weirderresult = parse (
173- `
174- li[attr="weirder\\"("] a:hover, li[attr="weirder\\")"] a {
175- background-color: red;
176- }
177- ` ,
178- ) ;
179- expect (
180- ( weirderresult . stylesheet ! . rules [ 0 ] as Rule ) ! . selectors ! . length ,
181- ) . toEqual ( 2 ) ;
182-
183- const commainstrresult = parse (
184- `
185- li[attr="has,comma"] a:hover {
186- background-color: red;
187- }
188- ` ,
189- ) ;
190- expect (
191- ( commainstrresult . stylesheet ! . rules [ 0 ] as Rule ) ! . selectors ! . length ,
192- ) . toEqual ( 1 ) ;
193- } ) ;
194-
195122 it . each ( [
196123 [ '.foo,.bar {}' , [ '.foo' , '.bar' ] ] ,
197124 [ '.bar:has(:disabled) {}' , [ '.bar:has(:disabled)' ] ] ,
@@ -202,11 +129,11 @@ li[attr="has,comma"] a:hover {
202129 ] ,
203130 [
204131 '.bar:has(div, input:is(:disabled), button) {}' ,
205- [ '.bar:has(div, input:is(:disabled), button)' ] ,
132+ [ '.bar:has(div,input:is(:disabled), button)' ] ,
206133 ] ,
207134 [
208135 '.bar:has(div, input:is(:disabled),button:has(:disabled,.baz)) {}' ,
209- [ '.bar:has(div, input:is(:disabled),button:has(:disabled,.baz))' ] ,
136+ [ '.bar:has(div,input:is(:disabled),button:has(:disabled,.baz))' ] ,
210137 ] ,
211138 [
212139 '.bar:has(input), .foo:has(input, button), .baz {}' ,
@@ -215,15 +142,17 @@ li[attr="has,comma"] a:hover {
215142 [
216143 '.bar:has(input:is(:disabled),button:has(:disabled,.baz), div:has(:disabled,.baz)){color: red;}' ,
217144 [
218- '.bar:has(input:is(:disabled),button:has(:disabled,.baz), div:has(:disabled,.baz))' ,
145+ '.bar:has(input:is(:disabled),button:has(:disabled,.baz),div:has(:disabled,.baz))' ,
219146 ] ,
220147 ] ,
148+ [ '.bar((( {}' , [ '.bar(((' ] ] ,
221149 [
222150 '.bar:has(:has(:has(a), :has(:has(:has(b, :has(a), c), e))), input:is(:disabled), button) {}' ,
223151 [
224- '.bar:has(:has(:has(a), :has(:has(:has(b, :has(a), c), e))), input:is(:disabled), button)' ,
152+ '.bar:has(:has(:has(a),:has(:has(:has(b,:has(a), c), e))),input:is(:disabled), button)' ,
225153 ] ,
226154 ] ,
155+ [ '.foo,.bar(((,.baz {}' , [ '.foo' , '.bar(((' , '.baz' ] ] ,
227156 [
228157 '.foo,.bar:has(input:is(:disabled)){color: red;}' ,
229158 [ '.foo' , '.bar:has(input:is(:disabled))' ] ,
@@ -236,14 +165,14 @@ li[attr="has,comma"] a:hover {
236165 '.foo,.bar:has(input:is(:disabled),button:has(:disabled), div:has(:disabled,.baz)){color: red;}' ,
237166 [
238167 '.foo' ,
239- '.bar:has(input:is(:disabled),button:has(:disabled), div:has(:disabled,.baz))' ,
168+ '.bar:has(input:is(:disabled),button:has(:disabled),div:has(:disabled,.baz))' ,
240169 ] ,
241170 ] ,
242171 [
243172 '.foo,.bar:has(input:is(:disabled),button:has(:disabled,.baz), div:has(:disabled,.baz)){color: red;}' ,
244173 [
245174 '.foo' ,
246- '.bar:has(input:is(:disabled),button:has(:disabled,.baz), div:has(:disabled,.baz))' ,
175+ '.bar:has(input:is(:disabled),button:has(:disabled,.baz),div:has(:disabled,.baz))' ,
247176 ] ,
248177 ] ,
249178 [ '.bar:has(:disabled), .foo {}' , [ '.bar:has(:disabled)' , '.foo' ] ] ,
0 commit comments