forked from tailwindlabs/tailwindcss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreenAtRule.test.js
More file actions
58 lines (55 loc) · 1.14 KB
/
screenAtRule.test.js
File metadata and controls
58 lines (55 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import postcss from 'postcss'
import plugin from '../src/lib/substituteScreenAtRules'
import config from '../stubs/config.full.js'
import { css } from './util/run'
function run(input, opts = config) {
return postcss([plugin({ tailwindConfig: opts })]).process(input, { from: undefined })
}
test('it can generate media queries from configured screen sizes', () => {
let input = css`
@screen sm {
.banana {
color: yellow;
}
}
@screen md {
.banana {
color: red;
}
}
@screen lg {
.banana {
color: green;
}
}
`
return run(input, {
theme: {
screens: {
sm: '500px',
md: '750px',
lg: '1000px',
},
},
separator: ':',
}).then((result) => {
expect(result.css).toMatchFormattedCss(css`
@media (min-width: 500px) {
.banana {
color: #ff0;
}
}
@media (min-width: 750px) {
.banana {
color: red;
}
}
@media (min-width: 1000px) {
.banana {
color: green;
}
}
`)
expect(result.warnings().length).toBe(0)
})
})