Merge pull request #732 from GeoffSelby/add-disabled-variant

Add `disabled` variant
This commit is contained in:
Adam Wathan 2019-07-10 08:27:23 -04:00 committed by GitHub
commit 5080129b71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 0 deletions

View File

@ -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 {

View File

@ -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 }) {