@@ -1002,14 +1002,10 @@ describe('using apply with the prefix option', () => {
1002
1002
1003
1003
test ( 'a "Did You Mean" suggestion is omitted if a similar class cannot be identified.' , ( ) => {
1004
1004
const input = `
1005
- .foo { @apply anteater; }
1006
- `
1005
+ .foo { @apply anteater; }
1006
+ `
1007
1007
1008
- const config = resolveConfig ( [
1009
- {
1010
- ...defaultConfig ,
1011
- } ,
1012
- ] )
1008
+ const config = resolveConfig ( [ { ...defaultConfig } ] )
1013
1009
1014
1010
expect . assertions ( 1 )
1015
1011
@@ -1109,7 +1105,7 @@ test('you can apply classes to a rule with multiple selectors', () => {
1109
1105
@apply float-left opacity-50 hover:opacity-100 md:float-right;
1110
1106
}
1111
1107
}
1112
- `
1108
+ `
1113
1109
1114
1110
const expected = `
1115
1111
@supports (display: grid) {
@@ -1134,6 +1130,48 @@ test('you can apply classes to a rule with multiple selectors', () => {
1134
1130
} )
1135
1131
} )
1136
1132
1133
+ test ( 'you can apply classes to a rule with multiple selectors with important and a prefix enabled' , ( ) => {
1134
+ const input = `
1135
+ @supports (display: grid) {
1136
+ .foo, h1 > .bar * {
1137
+ @apply tw-float-left tw-opacity-50 hover:tw-opacity-100 md:tw-float-right;
1138
+ }
1139
+ }
1140
+ `
1141
+
1142
+ const expected = `
1143
+ @supports (display: grid) {
1144
+ .foo, h1 > .bar * {
1145
+ float: left;
1146
+ opacity: 0.5;
1147
+ }
1148
+
1149
+ .foo:hover, h1 > .bar *:hover {
1150
+ opacity: 1;
1151
+ }
1152
+
1153
+ @media (min-width: 768px) {
1154
+ .foo, h1 > .bar * {
1155
+ float: right;
1156
+ }
1157
+ }
1158
+ }
1159
+ `
1160
+
1161
+ const config = resolveConfig ( [
1162
+ {
1163
+ ...defaultConfig ,
1164
+ prefix : 'tw-' ,
1165
+ important : true ,
1166
+ } ,
1167
+ ] )
1168
+
1169
+ return run ( input , config ) . then ( ( result ) => {
1170
+ expect ( result . css ) . toMatchCss ( expected )
1171
+ expect ( result . warnings ( ) . length ) . toBe ( 0 )
1172
+ } )
1173
+ } )
1174
+
1137
1175
test ( 'you can apply classes in a nested rule' , ( ) => {
1138
1176
const input = `
1139
1177
.selector {
@@ -1241,11 +1279,11 @@ test('declarations within a rule that uses @apply can be !important', () => {
1241
1279
`
1242
1280
1243
1281
const expected = `
1244
- .foo {
1245
- text-align: center;
1246
- float: left;
1247
- display: block !important;
1248
- }
1282
+ .foo {
1283
+ text-align: center;
1284
+ float: left;
1285
+ display: block !important;
1286
+ }
1249
1287
`
1250
1288
1251
1289
expect . assertions ( 2 )
@@ -1266,11 +1304,11 @@ test('declarations within a rule that uses @apply with !important remain not !im
1266
1304
`
1267
1305
1268
1306
const expected = `
1269
- .foo {
1270
- text-align: center !important;
1271
- float: left;
1272
- display: block !important;
1273
- }
1307
+ .foo {
1308
+ text-align: center !important;
1309
+ float: left;
1310
+ display: block !important;
1311
+ }
1274
1312
`
1275
1313
1276
1314
expect . assertions ( 2 )
0 commit comments