Skip to content

Commit a4cff3c

Browse files
committed
Add nested at-rule tests
1 parent 00a79e6 commit a4cff3c

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

tests/arbitrary-variants.test.js

+62
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,37 @@ test('at-rules', () => {
158158
})
159159
})
160160

161+
test('nested at-rules', () => {
162+
let config = {
163+
content: [
164+
{
165+
raw: html`<div class="[@media_screen{@media_(hover:hover)}]:underline"></div>`,
166+
},
167+
],
168+
corePlugins: { preflight: false },
169+
}
170+
171+
let input = css`
172+
@tailwind base;
173+
@tailwind components;
174+
@tailwind utilities;
175+
`
176+
177+
return run(input, config).then((result) => {
178+
expect(result.css).toMatchFormattedCss(css`
179+
${defaults}
180+
181+
@media screen {
182+
@media (hover: hover) {
183+
.\[\@media_screen\{\@media_\(hover\:hover\)\}\]\:underline {
184+
text-decoration-line: underline;
185+
}
186+
}
187+
}
188+
`)
189+
})
190+
})
191+
161192
test('at-rules with selector modifications', () => {
162193
let config = {
163194
content: [{ raw: html`<div class="[@media_(hover:hover){&:hover}]:underline"></div>` }],
@@ -183,6 +214,37 @@ test('at-rules with selector modifications', () => {
183214
})
184215
})
185216

217+
test('nested at-rules with selector modifications', () => {
218+
let config = {
219+
content: [
220+
{
221+
raw: html`<div class="[@media_screen{@media_(hover:hover){&:hover}}]:underline"></div>`,
222+
},
223+
],
224+
corePlugins: { preflight: false },
225+
}
226+
227+
let input = css`
228+
@tailwind base;
229+
@tailwind components;
230+
@tailwind utilities;
231+
`
232+
233+
return run(input, config).then((result) => {
234+
expect(result.css).toMatchFormattedCss(css`
235+
${defaults}
236+
237+
@media screen {
238+
@media (hover: hover) {
239+
.\[\@media_screen\{\@media_\(hover\:hover\)\{\&\:hover\}\}\]\:underline:hover {
240+
text-decoration-line: underline;
241+
}
242+
}
243+
}
244+
`)
245+
})
246+
})
247+
186248
test('attribute selectors', () => {
187249
let config = {
188250
content: [{ raw: html`<div class="[&[data-open]]:underline"></div>` }],

0 commit comments

Comments
 (0)