@@ -1011,6 +1011,83 @@ describe('addUtilities()', () => {
1011
1011
)
1012
1012
} ) . rejects . toThrowError ( / i n v a l i d u t i l i t y s e l e c t o r / )
1013
1013
} )
1014
+
1015
+ test ( 'supports multiple selector names' , async ( ) => {
1016
+ let compiled = await compile (
1017
+ css `
1018
+ @plugin "my-plugin" ;
1019
+ @tailwind utilities;
1020
+
1021
+ @theme reference {
1022
+ --breakpoint-lg : 1024px ;
1023
+ }
1024
+ ` ,
1025
+ {
1026
+ async loadPlugin ( ) {
1027
+ return ( { addUtilities } : PluginAPI ) => {
1028
+ addUtilities ( {
1029
+ '.form-input, .form-textarea' : {
1030
+ appearance : 'none' ,
1031
+ 'background-color' : '#fff' ,
1032
+ } ,
1033
+ } )
1034
+ }
1035
+ } ,
1036
+ } ,
1037
+ )
1038
+
1039
+ expect ( optimizeCss ( compiled . build ( [ 'form-input' , 'lg:form-textarea' ] ) ) . trim ( ) )
1040
+ . toMatchInlineSnapshot ( `
1041
+ ".form-input {
1042
+ appearance: none;
1043
+ background-color: #fff;
1044
+ }
1045
+
1046
+ @media (width >= 1024px) {
1047
+ .lg\\:form-textarea {
1048
+ appearance: none;
1049
+ background-color: #fff;
1050
+ }
1051
+ }"
1052
+ ` )
1053
+ } )
1054
+
1055
+ test ( 'supports pseudo classes and pseudo elements' , async ( ) => {
1056
+ let compiled = await compile (
1057
+ css `
1058
+ @plugin "my-plugin" ;
1059
+ @tailwind utilities;
1060
+
1061
+ @theme reference {
1062
+ --breakpoint-lg : 1024px ;
1063
+ }
1064
+ ` ,
1065
+ {
1066
+ async loadPlugin ( ) {
1067
+ return ( { addUtilities } : PluginAPI ) => {
1068
+ addUtilities ( {
1069
+ '.form-input, .form-textarea:hover:focus' : {
1070
+ 'background-color' : 'red' ,
1071
+ } ,
1072
+ } )
1073
+ }
1074
+ } ,
1075
+ } ,
1076
+ )
1077
+
1078
+ expect ( optimizeCss ( compiled . build ( [ 'form-input' , 'lg:form-textarea' ] ) ) . trim ( ) )
1079
+ . toMatchInlineSnapshot ( `
1080
+ ".form-input {
1081
+ background-color: red;
1082
+ }
1083
+
1084
+ @media (width >= 1024px) {
1085
+ .lg\\:form-textarea:hover:focus {
1086
+ background-color: red;
1087
+ }
1088
+ }"
1089
+ ` )
1090
+ } )
1014
1091
} )
1015
1092
1016
1093
describe ( 'matchUtilities()' , ( ) => {
0 commit comments