@@ -135,6 +135,27 @@ test('it can generate focus-within variants', () => {
135135 } )
136136} )
137137
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+
138159test ( 'it can generate first-child variants' , ( ) => {
139160 const input = `
140161 @variants first {
@@ -415,7 +436,7 @@ test('variants are generated in the order specified', () => {
415436
416437test ( 'the built-in variant pseudo-selectors are appended before any pseudo-elements' , ( ) => {
417438 const input = `
418- @variants hover, focus-within, focus, active, group-hover {
439+ @variants hover, focus-within, focus-visible, focus , active, group-hover {
419440 .placeholder-yellow::placeholder { color: yellow; }
420441 }
421442 `
@@ -424,6 +445,7 @@ test('the built-in variant pseudo-selectors are appended before any pseudo-eleme
424445 .placeholder-yellow::placeholder { color: yellow; }
425446 .hover\\:placeholder-yellow:hover::placeholder { color: yellow; }
426447 .focus-within\\:placeholder-yellow:focus-within::placeholder { color: yellow; }
448+ .focus-visible\\:placeholder-yellow:focus-visible::placeholder { color: yellow; }
427449 .focus\\:placeholder-yellow:focus::placeholder { color: yellow; }
428450 .active\\:placeholder-yellow:active::placeholder { color: yellow; }
429451 .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
624646 ...config . plugins ,
625647 function ( { addVariant, e } ) {
626648 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+ } )
628653 supportsRule . nodes = container . nodes
629654 container . nodes = [ supportsRule ]
630655 supportsRule . walkRules ( rule => {
0 commit comments