Skip to content

Commit

Permalink
Merge pull request tailwindlabs#732 from GeoffSelby/add-disabled-variant
Browse files Browse the repository at this point in the history
Add `disabled` variant
  • Loading branch information
adamwathan authored Jul 10, 2019
2 parents 79761b8 + 64cea13 commit 5080129
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions __tests__/variantsAtRule.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,27 @@ test('it can generate hover variants', () => {
})
})

test('it can generate disabled variants', () => {
const input = `
@variants disabled {
.banana { color: yellow; }
.chocolate { color: brown; }
}
`

const output = `
.banana { color: yellow; }
.chocolate { color: brown; }
.disabled\\:banana:disabled { color: yellow; }
.disabled\\:chocolate:disabled { color: brown; }
`

return run(input).then(result => {
expect(result.css).toMatchCss(output)
expect(result.warnings().length).toBe(0)
})
})

test('it can generate active variants', () => {
const input = `
@variants active {
Expand Down
1 change: 1 addition & 0 deletions src/lib/substituteVariantsAtRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const defaultVariantGenerators = {
'focus-within': generatePseudoClassVariant('focus-within'),
focus: generatePseudoClassVariant('focus'),
active: generatePseudoClassVariant('active'),
disabled: generatePseudoClassVariant('disabled'),
}

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

0 comments on commit 5080129

Please sign in to comment.