Merge pull request #1285 from GeoffSelby/add-checked-variant
Add `checked` variant
This commit is contained in:
commit
20e5695165
2 changed files with 22 additions and 0 deletions
|
|
@ -51,6 +51,27 @@ test('it can generate disabled variants', () => {
|
|||
})
|
||||
})
|
||||
|
||||
test('it can generate checked variants', () => {
|
||||
const input = `
|
||||
@variants checked {
|
||||
.banana { color: yellow; }
|
||||
.chocolate { color: brown; }
|
||||
}
|
||||
`
|
||||
|
||||
const output = `
|
||||
.banana { color: yellow; }
|
||||
.chocolate { color: brown; }
|
||||
.checked\\:banana:checked { color: yellow; }
|
||||
.checked\\:chocolate:checked { 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 {
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ const defaultVariantGenerators = config => ({
|
|||
active: generatePseudoClassVariant('active'),
|
||||
visited: generatePseudoClassVariant('visited'),
|
||||
disabled: generatePseudoClassVariant('disabled'),
|
||||
checked: generatePseudoClassVariant('checked'),
|
||||
first: generatePseudoClassVariant('first-child', 'first'),
|
||||
last: generatePseudoClassVariant('last-child', 'last'),
|
||||
odd: generatePseudoClassVariant('nth-child(odd)', 'odd'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue