Skip to content

Commit 20e5695

Browse files
authored
Merge pull request tailwindlabs#1285 from GeoffSelby/add-checked-variant
Add `checked` variant
2 parents 324d9e6 + c74ff99 commit 20e5695

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
@@ -51,6 +51,27 @@ test('it can generate disabled variants', () => {
5151
})
5252
})
5353

54+
test('it can generate checked variants', () => {
55+
const input = `
56+
@variants checked {
57+
.banana { color: yellow; }
58+
.chocolate { color: brown; }
59+
}
60+
`
61+
62+
const output = `
63+
.banana { color: yellow; }
64+
.chocolate { color: brown; }
65+
.checked\\:banana:checked { color: yellow; }
66+
.checked\\:chocolate:checked { color: brown; }
67+
`
68+
69+
return run(input).then(result => {
70+
expect(result.css).toMatchCss(output)
71+
expect(result.warnings().length).toBe(0)
72+
})
73+
})
74+
5475
test('it can generate active variants', () => {
5576
const input = `
5677
@variants active {

src/lib/substituteVariantsAtRules.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ const defaultVariantGenerators = config => ({
5656
active: generatePseudoClassVariant('active'),
5757
visited: generatePseudoClassVariant('visited'),
5858
disabled: generatePseudoClassVariant('disabled'),
59+
checked: generatePseudoClassVariant('checked'),
5960
first: generatePseudoClassVariant('first-child', 'first'),
6061
last: generatePseudoClassVariant('last-child', 'last'),
6162
odd: generatePseudoClassVariant('nth-child(odd)', 'odd'),

0 commit comments

Comments
 (0)