@@ -845,6 +845,132 @@ crosscheck(({ stable, oxide }) => {
845
845
} )
846
846
} )
847
847
848
+ test ( 'has-* variants with arbitrary values' , ( ) => {
849
+ let config = {
850
+ theme : { } ,
851
+ content : [
852
+ {
853
+ raw : html `
854
+ <div>
855
+ <figure class= "has-[figcaption]:inline-block" > </ figure>
856
+ <div class= "has-[.foo]:flex" > </ div>
857
+ <div class= "has-[.foo:hover]:block" > </ div>
858
+ <div class= "has-[[data-active]]:inline" > </ div>
859
+ <div class= "has-[>_.potato]:table" > </ div>
860
+ <div class= "has-[+_h2]:grid" > </ div>
861
+ <div class= "has-[>_h1_+_h2]:contents" > </ div>
862
+ <div class= "has-[h2]:has-[.banana]:hidden" > </ div>
863
+ </ div>
864
+ ` ,
865
+ } ,
866
+ ] ,
867
+ corePlugins : { preflight : false } ,
868
+ }
869
+
870
+ let input = css `
871
+ @tailwind utilities;
872
+ `
873
+
874
+ return run ( input , config ) . then ( ( result ) => {
875
+ expect ( result . css ) . toMatchFormattedCss ( css `
876
+ .has-\[\.foo\:hover\]\:block : has (.foo : hover ) {
877
+ display : block;
878
+ }
879
+ .has-\[figcaption\]\:inline-block : has (figcaption ) {
880
+ display : inline-block;
881
+ }
882
+ .has-\[\[data-active\]\]\:inline : has ([data-active ]) {
883
+ display : inline;
884
+ }
885
+ .has-\[\.foo\]\:flex : has (.foo ) {
886
+ display : flex;
887
+ }
888
+ .has-\[\>_\.potato\]\:table : has (> .potato ) {
889
+ display : table;
890
+ }
891
+ .has-\[\+_h2\]\:grid : has (+ h2 ) {
892
+ display : grid;
893
+ }
894
+ .has-\[\>_h1_\+_h2\]\:contents : has (> h1 + h2 ) {
895
+ display : contents;
896
+ }
897
+ .has-\[h2\]\:has-\[\.banana\]\:hidden : has (.banana ): has (h2 ) {
898
+ display : none;
899
+ }
900
+ ` )
901
+ } )
902
+ } )
903
+
904
+ test ( 'group-has-* variants with arbitrary values' , ( ) => {
905
+ let config = {
906
+ theme : { } ,
907
+ content : [
908
+ {
909
+ raw : html `
910
+ <div class= "group" >
911
+ <div class= "group-has-[>_h1_+_.foo]:block" > </ div>
912
+ </ div>
913
+ <div class= "group/two" >
914
+ <div class= "group-has-[>_h1_+_.foo]/two:flex" > </ div>
915
+ </ div>
916
+ ` ,
917
+ } ,
918
+ ] ,
919
+ corePlugins : { preflight : false } ,
920
+ }
921
+
922
+ let input = css `
923
+ @tailwind utilities;
924
+ `
925
+
926
+ return run ( input , config ) . then ( ( result ) => {
927
+ expect ( result . css ) . toMatchFormattedCss ( css `
928
+ .group : has (> h1 + .foo ) .group-has-\[\>_h1_\+_\.foo\]\:block {
929
+ display : block;
930
+ }
931
+ .group\/two : has (> h1 + .foo ) .group-has-\[\>_h1_\+_\.foo\]\/two\:flex {
932
+ display : flex;
933
+ }
934
+ ` )
935
+ } )
936
+ } )
937
+
938
+ test ( 'peer-has-* variants with arbitrary values' , ( ) => {
939
+ let config = {
940
+ theme : { } ,
941
+ content : [
942
+ {
943
+ raw : html `
944
+ <div>
945
+ <div className= "peer" > </ div>
946
+ <div class= "peer-has-[>_h1_+_.foo]:block" > </ div>
947
+ </ div>
948
+ <div>
949
+ <div className= "peer" > </ div>
950
+ <div class= "peer-has-[>_h1_+_.foo]/two:flex" > </ div>
951
+ </ div>
952
+ ` ,
953
+ } ,
954
+ ] ,
955
+ corePlugins : { preflight : false } ,
956
+ }
957
+
958
+ let input = css `
959
+ @tailwind utilities;
960
+ `
961
+
962
+ return run ( input , config ) . then ( ( result ) => {
963
+ expect ( result . css ) . toMatchFormattedCss ( css `
964
+ .peer : has (> h1 + .foo ) ~ .peer-has-\[\>_h1_\+_\.foo\]\:block {
965
+ display : block;
966
+ }
967
+ .peer\/two : has (> h1 + .foo ) ~ .peer-has-\[\>_h1_\+_\.foo\]\/two\:flex {
968
+ display : flex;
969
+ }
970
+ ` )
971
+ } )
972
+ } )
973
+
848
974
it ( 'should be possible to use modifiers and arbitrary groups' , ( ) => {
849
975
let config = {
850
976
content : [
0 commit comments