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 031604d
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions tests/arbitrary-variants.test.js
Expand Up @@ -158,6 +158,35 @@ 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 +212,35 @@ 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 031604d

Please sign in to comment.