Skip to content

Commit

Permalink
Add nested at-rule tests
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypticace committed May 8, 2022
1 parent 00a79e6 commit a4cff3c
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions tests/arbitrary-variants.test.js
Expand Up @@ -158,6 +158,37 @@ test('at-rules', () => {
})
})

test('nested at-rules', () => {
let config = {
content: [
{
raw: html`<div class="[@media_screen{@media_(hover:hover)}]:underline"></div>`,
},
],
corePlugins: { preflight: false },
}

let input = css`
@tailwind base;
@tailwind components;
@tailwind utilities;
`

return run(input, config).then((result) => {
expect(result.css).toMatchFormattedCss(css`
${defaults}
@media screen {
@media (hover: hover) {
.\[\@media_screen\{\@media_\(hover\:hover\)\}\]\:underline {
text-decoration-line: underline;
}
}
}
`)
})
})

test('at-rules with selector modifications', () => {
let config = {
content: [{ raw: html`<div class="[@media_(hover:hover){&:hover}]:underline"></div>` }],
Expand All @@ -183,6 +214,37 @@ test('at-rules with selector modifications', () => {
})
})

test('nested at-rules with selector modifications', () => {
let config = {
content: [
{
raw: html`<div class="[@media_screen{@media_(hover:hover){&:hover}}]:underline"></div>`,
},
],
corePlugins: { preflight: false },
}

let input = css`
@tailwind base;
@tailwind components;
@tailwind utilities;
`

return run(input, config).then((result) => {
expect(result.css).toMatchFormattedCss(css`
${defaults}
@media screen {
@media (hover: hover) {
.\[\@media_screen\{\@media_\(hover\:hover\)\{\&\:hover\}\}\]\:underline:hover {
text-decoration-line: underline;
}
}
}
`)
})
})

test('attribute selectors', () => {
let config = {
content: [{ raw: html`<div class="[&[data-open]]:underline"></div>` }],
Expand Down

0 comments on commit a4cff3c

Please sign in to comment.