-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathindex.test.js
51 lines (44 loc) · 1.39 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
41
42
43
44
45
46
47
48
49
50
51
let { equal } = require('node:assert')
let { test } = require('node:test')
let postcss = require('postcss')
let plugin = require('./')
function run (input, output) {
let result = postcss([plugin]).process(input, { from: undefined })
equal(result.css, output)
equal(result.warnings(), 0)
}
test('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 } } }'
)
})
test('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 } }'
)
})
test('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 } }'
)
})
test('inherits !important flag', () => {
run(
'.max { max-height: 100vh !important }',
'.max { max-height: 100vh !important }\n' +
'@supports (-webkit-touch-callout: none) {\n' +
' .max { max-height: -webkit-fill-available !important } }'
)
})
test('ignores non-100vh height', () => {
run('body { max-height: 100% }', 'body { max-height: 100% }')
})