Add support for :visited state variant
This commit is contained in:
parent
ca670f5a76
commit
1efc5d1d44
2 changed files with 22 additions and 0 deletions
|
|
@ -51,6 +51,27 @@ test('it can generate active variants', () => {
|
|||
})
|
||||
})
|
||||
|
||||
test('it can generate visited variants', () => {
|
||||
const input = `
|
||||
@variants visited {
|
||||
.banana { color: yellow; }
|
||||
.chocolate { color: brown; }
|
||||
}
|
||||
`
|
||||
|
||||
const output = `
|
||||
.banana { color: yellow; }
|
||||
.chocolate { color: brown; }
|
||||
.visited\\:banana:visited { color: yellow; }
|
||||
.visited\\:chocolate:visited { color: brown; }
|
||||
`
|
||||
|
||||
return run(input).then(result => {
|
||||
expect(result.css).toMatchCss(output)
|
||||
expect(result.warnings().length).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
test('it can generate focus variants', () => {
|
||||
const input = `
|
||||
@variants focus {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ const defaultVariantGenerators = {
|
|||
'focus-within': generatePseudoClassVariant('focus-within'),
|
||||
focus: generatePseudoClassVariant('focus'),
|
||||
active: generatePseudoClassVariant('active'),
|
||||
visited: generatePseudoClassVariant('visited'),
|
||||
}
|
||||
|
||||
export default function(config, { variantGenerators: pluginVariantGenerators }) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue