Skip to content

Commit 031604d

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

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

tests/arbitrary-variants.test.js

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

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

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

0 commit comments

Comments
 (0)