@@ -93,25 +93,15 @@ describe('ShadowCss', () => {
93
93
'div[contenta]:where(.one) {}' ,
94
94
) ;
95
95
expect ( shim ( 'div:where() {}' , 'contenta' , 'hosta' ) ) . toEqualCss ( 'div[contenta]:where() {}' ) ;
96
- // See `xit('should parse concatenated pseudo selectors'`
97
96
expect ( shim ( ':where(a):where(b) {}' , 'contenta' , 'hosta' ) ) . toEqualCss (
98
- ':where(a) [contenta]:where(b) {}' ,
97
+ ':where(a[contenta]) :where(b[contenta] ) {}' ,
99
98
) ;
100
99
expect ( shim ( '*:where(.one) {}' , 'contenta' , 'hosta' ) ) . toEqualCss ( '*[contenta]:where(.one) {}' ) ;
101
100
expect ( shim ( '*:where(.one) ::ng-deep .foo {}' , 'contenta' , 'hosta' ) ) . toEqualCss (
102
101
'*[contenta]:where(.one) .foo {}' ,
103
102
) ;
104
103
} ) ;
105
104
106
- xit ( 'should parse concatenated pseudo selectors' , ( ) => {
107
- // Current logic leads to a result with an outer scope
108
- // It could be changed, to not increase specificity
109
- // Requires a more complex parsing
110
- expect ( shim ( ':where(a):where(b) {}' , 'contenta' , 'hosta' ) ) . toEqualCss (
111
- ':where(a[contenta]):where(b[contenta]) {}' ,
112
- ) ;
113
- } ) ;
114
-
115
105
it ( 'should handle pseudo functions correctly' , ( ) => {
116
106
// :where()
117
107
expect ( shim ( ':where(.one) {}' , 'contenta' , 'hosta' ) ) . toEqualCss ( ':where(.one[contenta]) {}' ) ;
@@ -200,6 +190,18 @@ describe('ShadowCss', () => {
200
190
) . toEqualCss (
201
191
':where(:where(a[contenta]:has(.foo), b[contenta]) :is(.one[contenta], .two[contenta]:where(.foo > .bar))) {}' ,
202
192
) ;
193
+ expect ( shim ( ':where(.two):first-child {}' , 'contenta' , 'hosta' ) ) . toEqualCss (
194
+ '[contenta]:where(.two):first-child {}' ,
195
+ ) ;
196
+ expect ( shim ( ':first-child:where(.two) {}' , 'contenta' , 'hosta' ) ) . toEqualCss (
197
+ '[contenta]:first-child:where(.two) {}' ,
198
+ ) ;
199
+ expect ( shim ( ':where(.two):nth-child(3) {}' , 'contenta' , 'hosta' ) ) . toEqualCss (
200
+ '[contenta]:where(.two):nth-child(3) {}' ,
201
+ ) ;
202
+ expect ( shim ( 'table :where(td, th):hover { color: lime; }' , 'contenta' , 'hosta' ) ) . toEqualCss (
203
+ 'table[contenta] [contenta]:where(td, th):hover { color:lime;}' ,
204
+ ) ;
203
205
204
206
// complex selectors
205
207
expect ( shim ( ':host:is([foo],[foo-2])>div.example-2 {}' , 'contenta' , 'a-host' ) ) . toEqualCss (
@@ -272,6 +274,18 @@ describe('ShadowCss', () => {
272
274
expect ( shim ( '.one :where(:host, .two) {}' , 'contenta' , 'hosta' ) ) . toEqualCss (
273
275
'.one :where([hosta], .two[contenta]) {}' ,
274
276
) ;
277
+ expect ( shim ( ':is(.foo):is(:host):is(.two) {}' , 'contenta' , 'hosta' ) ) . toEqualCss (
278
+ ':is(.foo):is([hosta]):is(.two[contenta]) {}' ,
279
+ ) ;
280
+ expect ( shim ( ':where(.one, :host .two):first-letter {}' , 'contenta' , 'hosta' ) ) . toEqualCss (
281
+ '[contenta]:where(.one, [hosta] .two):first-letter {}' ,
282
+ ) ;
283
+ expect ( shim ( ':first-child:where(.one, :host .two) {}' , 'contenta' , 'hosta' ) ) . toEqualCss (
284
+ '[contenta]:first-child:where(.one, [hosta] .two) {}' ,
285
+ ) ;
286
+ expect (
287
+ shim ( ':where(.one, :host .two):nth-child(3):is(.foo, a:where(.bar)) {}' , 'contenta' , 'hosta' ) ,
288
+ ) . toEqualCss ( '[contenta]:where(.one, [hosta] .two):nth-child(3):is(.foo, a:where(.bar)) {}' ) ;
275
289
} ) ;
276
290
277
291
it ( 'should handle escaped selector with space (if followed by a hex char)' , ( ) => {
0 commit comments