Skip to content

Commit

Permalink
add scripting variants
Browse files Browse the repository at this point in the history
Co-authored-by: Luke Warlow <luke@warlow.dev>
  • Loading branch information
RobinMalfait and lukewarlow committed Apr 17, 2024
1 parent cc8c069 commit 60381fb
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/tailwindcss/src/__snapshots__/intellisense.test.ts.snap
Expand Up @@ -2424,5 +2424,19 @@ exports[`getVariants 1`] = `
"selectors": [Function],
"values": [],
},
{
"hasDash": true,
"isArbitrary": false,
"name": "noscript",
"selectors": [Function],
"values": [],
},
{
"hasDash": true,
"isArbitrary": false,
"name": "scripting",
"selectors": [Function],
"values": [],
},
]
`;
20 changes: 20 additions & 0 deletions packages/tailwindcss/src/variants.test.ts
Expand Up @@ -1546,6 +1546,26 @@ test('forced-colors', () => {
`)
})

test('noscript', () => {
expect(run(['noscript:flex'])).toMatchInlineSnapshot(`
"@media (scripting: none) {
.noscript\\:flex {
display: flex;
}
}"
`)
})

test('scripting', () => {
expect(run(['scripting:flex'])).toMatchInlineSnapshot(`
"@media (scripting: enabled) {
.scripting\\:flex {
display: flex;
}
}"
`)
})

test('container queries', () => {
expect(
compileCss(
Expand Down
3 changes: 3 additions & 0 deletions packages/tailwindcss/src/variants.ts
Expand Up @@ -701,5 +701,8 @@ export function createVariants(theme: Theme): Variants {

staticVariant('forced-colors', ['@media (forced-colors: active)'], { compounds: false })

staticVariant('noscript', ['@media (scripting: none)'], { compounds: false })
staticVariant('scripting', ['@media (scripting: enabled)'], { compounds: false })

return variants
}

0 comments on commit 60381fb

Please sign in to comment.