Skip to content

Commit eeb7886

Browse files
committed
Add test for generating variants for multi-selector rules
1 parent 12857dd commit eeb7886

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

__tests__/variantsAtRule.test.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,31 @@ test('it can generate hover, active and focus variants', () => {
139139
})
140140
})
141141

142+
test('it can generate hover, active and focus variants for multiple classes in one rule', () => {
143+
const input = `
144+
@variants hover, focus, active {
145+
.banana, .lemon { color: yellow; }
146+
.chocolate, .coconut { color: brown; }
147+
}
148+
`
149+
150+
const output = `
151+
.banana, .lemon { color: yellow; }
152+
.chocolate, .coconut { color: brown; }
153+
.hover\\:banana:hover, .hover\\:lemon:hover { color: yellow; }
154+
.hover\\:chocolate:hover, .hover\\:coconut:hover { color: brown; }
155+
.focus\\:banana:focus, .focus\\:lemon:focus { color: yellow; }
156+
.focus\\:chocolate:focus, .focus\\:coconut:focus { color: brown; }
157+
.active\\:banana:active, .active\\:lemon:active { color: yellow; }
158+
.active\\:chocolate:active, .active\\:coconut:active { color: brown; }
159+
`
160+
161+
return run(input).then(result => {
162+
expect(result.css).toMatchCss(output)
163+
expect(result.warnings().length).toBe(0)
164+
})
165+
})
166+
142167
test('it wraps the output in a responsive at-rule if responsive is included as a variant', () => {
143168
const input = `
144169
@variants responsive, hover, focus {

0 commit comments

Comments
 (0)