@@ -135,6 +135,27 @@ test('it can generate focus-within variants', () => {
135
135
} )
136
136
} )
137
137
138
+ test ( 'it can generate focus-visible variants' , ( ) => {
139
+ const input = `
140
+ @variants focus-visible {
141
+ .banana { color: yellow; }
142
+ .chocolate { color: brown; }
143
+ }
144
+ `
145
+
146
+ const output = `
147
+ .banana { color: yellow; }
148
+ .chocolate { color: brown; }
149
+ .focus-visible\\:banana:focus-visible { color: yellow; }
150
+ .focus-visible\\:chocolate:focus-visible { color: brown; }
151
+ `
152
+
153
+ return run ( input ) . then ( result => {
154
+ expect ( result . css ) . toMatchCss ( output )
155
+ expect ( result . warnings ( ) . length ) . toBe ( 0 )
156
+ } )
157
+ } )
158
+
138
159
test ( 'it can generate first-child variants' , ( ) => {
139
160
const input = `
140
161
@variants first {
@@ -415,7 +436,7 @@ test('variants are generated in the order specified', () => {
415
436
416
437
test ( 'the built-in variant pseudo-selectors are appended before any pseudo-elements' , ( ) => {
417
438
const input = `
418
- @variants hover, focus-within, focus, active, group-hover {
439
+ @variants hover, focus-within, focus-visible, focus , active, group-hover {
419
440
.placeholder-yellow::placeholder { color: yellow; }
420
441
}
421
442
`
@@ -424,6 +445,7 @@ test('the built-in variant pseudo-selectors are appended before any pseudo-eleme
424
445
.placeholder-yellow::placeholder { color: yellow; }
425
446
.hover\\:placeholder-yellow:hover::placeholder { color: yellow; }
426
447
.focus-within\\:placeholder-yellow:focus-within::placeholder { color: yellow; }
448
+ .focus-visible\\:placeholder-yellow:focus-visible::placeholder { color: yellow; }
427
449
.focus\\:placeholder-yellow:focus::placeholder { color: yellow; }
428
450
.active\\:placeholder-yellow:active::placeholder { color: yellow; }
429
451
.group:hover .group-hover\\:placeholder-yellow::placeholder { color: yellow; }
@@ -624,7 +646,10 @@ test('plugin variants can wrap rules in another at-rule using the raw PostCSS AP
624
646
...config . plugins ,
625
647
function ( { addVariant, e } ) {
626
648
addVariant ( 'supports-grid' , ( { container, separator } ) => {
627
- const supportsRule = postcss . atRule ( { name : 'supports' , params : '(display: grid)' } )
649
+ const supportsRule = postcss . atRule ( {
650
+ name : 'supports' ,
651
+ params : '(display: grid)' ,
652
+ } )
628
653
supportsRule . nodes = container . nodes
629
654
container . nodes = [ supportsRule ]
630
655
supportsRule . walkRules ( rule => {
0 commit comments