Skip to content

Commit 5080129

Browse files
authored
Merge pull request #732 from GeoffSelby/add-disabled-variant
Add `disabled` variant
2 parents 79761b8 + 64cea13 commit 5080129

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
@@ -36,6 +36,7 @@ const defaultVariantGenerators = {
3636
'focus-within': generatePseudoClassVariant('focus-within'),
3737
focus: generatePseudoClassVariant('focus'),
3838
active: generatePseudoClassVariant('active'),
39+
disabled: generatePseudoClassVariant('disabled'),
3940
}
4041

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

0 commit comments

Comments
 (0)