Skip to content

Commit a6bcd22

Browse files
committed
Add test for using variants with multi-class selectors
1 parent 7eabb74 commit a6bcd22

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/variants.test.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,39 @@ describe('custom advanced variants', () => {
134134
`)
135135
})
136136
})
137+
138+
test('using variants with multi-class selectors', () => {
139+
let config = {
140+
content: [
141+
{
142+
raw: html` <div class="screen:parent screen:child"></div> `,
143+
},
144+
],
145+
plugins: [
146+
function ({ addVariant, addComponents }) {
147+
addComponents({
148+
'.parent .child': {
149+
foo: 'bar',
150+
},
151+
})
152+
addVariant('screen', '@media screen')
153+
},
154+
],
155+
}
156+
157+
return run('@tailwind components;@tailwind utilities', config).then((result) => {
158+
return expect(result.css).toMatchFormattedCss(css`
159+
@media screen {
160+
.screen\:parent .child {
161+
foo: bar;
162+
}
163+
.parent .screen\:child {
164+
foo: bar;
165+
}
166+
}
167+
`)
168+
})
169+
})
137170
})
138171

139172
test('stacked peer variants', async () => {

0 commit comments

Comments
 (0)