-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
index.test.js
40 lines (34 loc) · 1.07 KB
/
index.test.js
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
let postcss = require('postcss')
let plugin = require('./')
function run (input, output) {
let result = postcss([plugin]).process(input, { from: undefined })
expect(result.css).toEqual(output)
expect(result.warnings()).toHaveLength(0)
}
it('adds -webkit-fill-available', () => {
run(
'@media (max-width: 600px) { body { height: 100vh } }',
'@media (max-width: 600px) { body { height: 100vh } ' +
'@supports (-webkit-touch-callout: none) { ' +
'body { height: -webkit-fill-available } } }'
)
})
it('supports min-height', () => {
run(
'.min { min-height: 100vh }',
'.min { min-height: 100vh }\n' +
'@supports (-webkit-touch-callout: none) {\n' +
' .min { min-height: -webkit-fill-available } }'
)
})
it('supports max-height', () => {
run(
'.max { max-height: 100vh }',
'.max { max-height: 100vh }\n' +
'@supports (-webkit-touch-callout: none) {\n' +
' .max { max-height: -webkit-fill-available } }'
)
})
it('ignores non-100vh height', () => {
run('body { max-height: 100% }', 'body { max-height: 100% }')
})