File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change @@ -1946,3 +1946,60 @@ test('the configFunction parameter is optional when using the `createPlugin.with
1946
1946
expect ( result . css ) . toMatchCss ( expected )
1947
1947
} )
1948
1948
} )
1949
+
1950
+ test ( 'plugins can extend variants' , ( ) => {
1951
+ const plugin = createPlugin ( function ( ) { } , {
1952
+ variants : {
1953
+ opacity : ( { before } ) => before ( [ 'active' ] , 'focus' ) ,
1954
+ } ,
1955
+ } )
1956
+
1957
+ return _postcss ( [
1958
+ tailwind ( {
1959
+ theme : {
1960
+ opacity : { '0' : '0' , '100' : '1' } ,
1961
+ } ,
1962
+ corePlugins : [ 'opacity' ] ,
1963
+ variants : { opacity : ( { without } ) => without ( [ 'responsive' ] ) } ,
1964
+ plugins : [ plugin ] ,
1965
+ } ) ,
1966
+ ] )
1967
+ . process (
1968
+ `
1969
+ @tailwind base;
1970
+ @tailwind components;
1971
+ @tailwind utilities;
1972
+ ` ,
1973
+ { from : undefined }
1974
+ )
1975
+ . then ( result => {
1976
+ const expected = `
1977
+ .opacity-0 {
1978
+ opacity: 0
1979
+ }
1980
+ .opacity-100 {
1981
+ opacity: 1
1982
+ }
1983
+ .hover\\:opacity-0:hover {
1984
+ opacity: 0
1985
+ }
1986
+ .hover\\:opacity-100:hover {
1987
+ opacity: 1
1988
+ }
1989
+ .active\\:opacity-0:active {
1990
+ opacity: 0
1991
+ }
1992
+ .active\\:opacity-100:active {
1993
+ opacity: 1
1994
+ }
1995
+ .focus\\:opacity-0:focus {
1996
+ opacity: 0
1997
+ }
1998
+ .focus\\:opacity-100:focus {
1999
+ opacity: 1
2000
+ }
2001
+ `
2002
+
2003
+ expect ( result . css ) . toMatchCss ( expected )
2004
+ } )
2005
+ } )
You can’t perform that action at this time.
0 commit comments