Skip to content

Commit 64cea13

Browse files
committed
Add disabled variant
This commit adds a `disabled` variant to the Tailwind core. Not sure if/where this would be used by default.
1 parent a7a95b1 commit 64cea13

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

__tests__/variantsAtRule.test.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,27 @@ test('it can generate hover variants', () => {
3030
})
3131
})
3232

33+
test('it can generate disabled variants', () => {
34+
const input = `
35+
@variants disabled {
36+
.banana { color: yellow; }
37+
.chocolate { color: brown; }
38+
}
39+
`
40+
41+
const output = `
42+
.banana { color: yellow; }
43+
.chocolate { color: brown; }
44+
.disabled\\:banana:disabled { color: yellow; }
45+
.disabled\\:chocolate:disabled { color: brown; }
46+
`
47+
48+
return run(input).then(result => {
49+
expect(result.css).toMatchCss(output)
50+
expect(result.warnings().length).toBe(0)
51+
})
52+
})
53+
3354
test('it can generate active variants', () => {
3455
const input = `
3556
@variants active {

src/lib/substituteVariantsAtRules.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const defaultVariantGenerators = {
2525
'focus-within': generatePseudoClassVariant('focus-within'),
2626
focus: generatePseudoClassVariant('focus'),
2727
active: generatePseudoClassVariant('active'),
28+
disabled: generatePseudoClassVariant('disabled'),
2829
}
2930

3031
export default function(config, { variantGenerators: pluginVariantGenerators }) {

0 commit comments

Comments
 (0)