@@ -615,3 +615,95 @@ test('classes in the same arbitrary variant should not be prefixed', () => {
615
615
` )
616
616
} )
617
617
} )
618
+
619
+ it ( 'should support supports' , ( ) => {
620
+ let config = {
621
+ experimental : { matchVariant : true } ,
622
+ theme : {
623
+ supports : {
624
+ grid : 'display: grid' ,
625
+ } ,
626
+ } ,
627
+ content : [
628
+ {
629
+ raw : html `
630
+ <div>
631
+ <!- - Property check - - >
632
+ <div class= "supports-[display:grid]:grid" > </ div>
633
+ <!- - Value with spaces, needs to be normalized -- >
634
+ <div class= "supports-[transform-origin:5%_5%]:underline" > </ div>
635
+ <!- - Selecto rs (raw) - - >
636
+ <div class= "supports-[selector(A>B)]:underline" > </ div>
637
+ <!- - 'not' check (raw) - - >
638
+ <div class= "supports-[not(foo:bar)]:underline" > </ div>
639
+ <!- - 'or' check (raw) - - >
640
+ <div class= "supports-[(foo:bar)or(bar:baz)]:underline" > </ div>
641
+ <!- - 'and' check (raw) - - >
642
+ <div class= "supports-[(foo:bar)and(bar:baz)]:underline" > </ div>
643
+ <!- - No value give for the property, defaulting to prop : var(- - tw) - - >
644
+ <div class= "supports-[container-type]:underline" > </ div>
645
+ <!- - Named suppor ts usage - - >
646
+ <div class= "supports-grid:underline" > </ div>
647
+ </ div>
648
+ ` ,
649
+ } ,
650
+ ] ,
651
+ corePlugins : { preflight : false } ,
652
+ }
653
+
654
+ let input = css `
655
+ @tailwind utilities;
656
+ `
657
+
658
+ return run ( input , config ) . then ( ( result ) => {
659
+ expect ( result . css ) . toMatchFormattedCss ( css `
660
+ @supports (display : grid) {
661
+ .supports-grid\:underline {
662
+ text-decoration-line : underline;
663
+ }
664
+ }
665
+
666
+ @supports (display : grid) {
667
+ .supports-\[display\:grid\]\:grid {
668
+ display : grid;
669
+ }
670
+ }
671
+
672
+ @supports (transform-origin : 5% 5% ) {
673
+ .supports-\[transform-origin\:5\%_5\%\]\:underline {
674
+ text-decoration-line : underline;
675
+ }
676
+ }
677
+
678
+ @supports selector(A > B ) {
679
+ .supports-\[selector\(A\>B\)\]\:underline {
680
+ text-decoration-line : underline;
681
+ }
682
+ }
683
+
684
+ @supports not (foo : bar) {
685
+ .supports-\[not\(foo\:bar\)\]\:underline {
686
+ text-decoration-line : underline;
687
+ }
688
+ }
689
+
690
+ @supports (foo : bar) or (bar : baz) {
691
+ .supports-\[\(foo\:bar\)or\(bar\:baz\)\]\:underline {
692
+ text-decoration-line : underline;
693
+ }
694
+ }
695
+
696
+ @supports (foo : bar) and (bar : baz) {
697
+ .supports-\[\(foo\:bar\)and\(bar\:baz\)\]\:underline {
698
+ text-decoration-line : underline;
699
+ }
700
+ }
701
+
702
+ @supports (container-type : var (--tw )) {
703
+ .supports-\[container-type\]\:underline {
704
+ text-decoration-line : underline;
705
+ }
706
+ }
707
+ ` )
708
+ } )
709
+ } )
0 commit comments