Skip to content

Commit e82ef53

Browse files
committed
Add test for creating responsive variants of classes with non-standard characters
1 parent 13ce379 commit e82ef53

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

__tests__/responsiveAtRule.test.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,46 @@ test('it can generate responsive variants with a custom separator', () => {
8686
})
8787
})
8888

89+
test('it can generate responsive variants when classes have non-standard characters', () => {
90+
const input = `
91+
@responsive {
92+
.hover\\:banana { color: yellow; }
93+
.chocolate-2\\.5 { color: brown; }
94+
}
95+
`
96+
97+
const output = `
98+
.hover\\:banana { color: yellow; }
99+
.chocolate-2\\.5 { color: brown; }
100+
@media (min-width: 500px) {
101+
.sm\\:hover\\:banana { color: yellow; }
102+
.sm\\:chocolate-2\\.5 { color: brown; }
103+
}
104+
@media (min-width: 750px) {
105+
.md\\:hover\\:banana { color: yellow; }
106+
.md\\:chocolate-2\\.5 { color: brown; }
107+
}
108+
@media (min-width: 1000px) {
109+
.lg\\:hover\\:banana { color: yellow; }
110+
.lg\\:chocolate-2\\.5 { color: brown; }
111+
}
112+
`
113+
114+
return run(input, {
115+
screens: {
116+
sm: '500px',
117+
md: '750px',
118+
lg: '1000px',
119+
},
120+
options: {
121+
separator: ':',
122+
},
123+
}).then(result => {
124+
expect(result.css).toMatchCss(output)
125+
expect(result.warnings().length).toBe(0)
126+
})
127+
})
128+
89129
test('responsive variants are grouped', () => {
90130
const input = `
91131
@responsive {

0 commit comments

Comments
 (0)