File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,10 +62,17 @@ const examplePlugin = plugin.withOptions(
6262 * https://tailwindcss.com/docs/plugins#adding-variants
6363 */
6464
65- addVariant ( 'hocus' , [
65+ // Simple
66+ addVariant ( 'optional' , '&:optional' )
67+
68+ // Array
69+ addVariant ( 'hocus' , [
6670 '&:hover' ,
6771 '&:focus'
6872 ] )
73+
74+ // @media queries
75+ addVariant ( 'supports-grid' , '@supports (display: grid)' )
6976 }
7077 } , function ( options ) {
7178 /**
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ it('addVariant', () => {
108108 } )
109109} )
110110
111- it ( 'addVariant (function )' , ( ) => {
111+ it ( 'addVariant (array )' , ( ) => {
112112 const config = { content : [ { raw : String . raw `<div class="hocus:opacity-0"></div>` } ] ,
113113 }
114114
@@ -123,3 +123,18 @@ it('addVariant (function)', () => {
123123 ` )
124124 } )
125125} )
126+
127+ it ( 'addVariant (media)' , ( ) => {
128+ const config = { content : [ { raw : String . raw `<div class="supports-grid:hidden"></div>` } ] ,
129+ }
130+
131+ return run ( config ) . then ( result => {
132+ expect ( result . css ) . toMatchCss ( String . raw `
133+ @supports (display: grid) {
134+ .supports-grid\:hidden {
135+ display: none;
136+ }
137+ }
138+ ` )
139+ } )
140+ } )
You can’t perform that action at this time.
0 commit comments