Skip to content

Commit c9bba9d

Browse files
committed
Merge branch 'thatguychrisw-add_visited_variant'
2 parents 5080129 + b1242a0 commit c9bba9d

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
@@ -72,6 +72,27 @@ test('it can generate active variants', () => {
7272
})
7373
})
7474

75+
test('it can generate visited variants', () => {
76+
const input = `
77+
@variants visited {
78+
.banana { color: yellow; }
79+
.chocolate { color: brown; }
80+
}
81+
`
82+
83+
const output = `
84+
.banana { color: yellow; }
85+
.chocolate { color: brown; }
86+
.visited\\:banana:visited { color: yellow; }
87+
.visited\\:chocolate:visited { color: brown; }
88+
`
89+
90+
return run(input).then(result => {
91+
expect(result.css).toMatchCss(output)
92+
expect(result.warnings().length).toBe(0)
93+
})
94+
})
95+
7596
test('it can generate focus variants', () => {
7697
const input = `
7798
@variants focus {

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+
visited: generatePseudoClassVariant('visited'),
3940
disabled: generatePseudoClassVariant('disabled'),
4041
}
4142

0 commit comments

Comments
 (0)