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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-values-4/#comp-func">
<link rel="help" href="https://drafts.csswg.org/css-values-4/#numbers">
<link rel="help" href="https://drafts.csswg.org/css-values-4/#calc-type-checking">
<link rel="author" title="Apple Inc">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../support/parsing-testcommon.js"></script>
<script>
function test_invalid_length_percentage(value) {
test_invalid_value('height', value);
test_invalid_value('height', `calc(${value})`);
}
function test_invalid_number(value) {
test_invalid_value('opacity', value);
}
// Syntax checking
test_invalid_number('round()');
test_invalid_number('round( )');
test_invalid_number('round(,)');
test_invalid_number('round(1, )');
test_invalid_number('round(, 1)');
test_invalid_number('round(1 + )');
test_invalid_number('round(1 - )');
test_invalid_number('round(1 * )');
test_invalid_number('round(1 / )');
test_invalid_number('round(1 2)');
test_invalid_number('round(nearest, 1 2)');
test_invalid_number('round(1, nearest, 12)');
test_invalid_number('round(1, nearest)');
test_invalid_number('round(nearest, 1, nearest)');
test_invalid_number('round(nearest, 1)');
test_invalid_number('round(1, , 2)');
test_invalid_number('mod()');
test_invalid_number('mod( )');
test_invalid_number('mod(,)');
test_invalid_number('mod(1, )');
test_invalid_number('mod(, 1)');
test_invalid_number('mod(1 + )');
test_invalid_number('mod(1 - )');
test_invalid_number('mod(1 * )');
test_invalid_number('mod(1 / )');
test_invalid_number('mod(1 2)');
test_invalid_number('mod(1, , 2)');
test_invalid_number('rem()');
test_invalid_number('rem( )');
test_invalid_number('rem(,)');
test_invalid_number('rem(1, )');
test_invalid_number('rem(, 1)');
test_invalid_number('rem(1 + )');
test_invalid_number('rem(1 - )');
test_invalid_number('rem(1 * )');
test_invalid_number('rem(1 / )');
test_invalid_number('rem(1 2)');
test_invalid_number('rem(1, , 2)');
// Type checking
test_invalid_number('round(0px)');
test_invalid_number('round(0s)');
test_invalid_number('round(0deg)');
test_invalid_number('round(0Hz)');
test_invalid_number('round(0dpi)');
test_invalid_number('round(0fr)');
test_invalid_number('round(1, 1%)');
test_invalid_number('round(1, 0px)');
test_invalid_number('round(1, 0s)');
test_invalid_number('round(1, 0deg)');
test_invalid_number('round(1, 0Hz)');
test_invalid_number('round(1, 0dpi)');
test_invalid_number('round(1, 0fr)');
test_invalid_number('mod(0px)');
test_invalid_number('mod(0s)');
test_invalid_number('mod(0deg)');
test_invalid_number('mod(0Hz)');
test_invalid_number('mod(0dpi)');
test_invalid_number('mod(0fr)');
test_invalid_number('mod(1, 1%)');
test_invalid_number('mod(1, 0px)');
test_invalid_number('mod(1, 0s)');
test_invalid_number('mod(1, 0deg)');
test_invalid_number('mod(1, 0Hz)');
test_invalid_number('mod(1, 0dpi)');
test_invalid_number('mod(1, 0fr)');
test_invalid_number('rem(0px)');
test_invalid_number('rem(0s)');
test_invalid_number('rem(0deg)');
test_invalid_number('rem(0Hz)');
test_invalid_number('rem(0dpi)');
test_invalid_number('rem(0fr)');
test_invalid_number('rem(1, 1%)');
test_invalid_number('rem(1, 0px)');
test_invalid_number('rem(1, 0s)');
test_invalid_number('rem(1, 0deg)');
test_invalid_number('rem(1, 0Hz)');
test_invalid_number('rem(1, 0dpi)');
test_invalid_number('rem(1, 0fr)');
test_invalid_length_percentage('round(0px, 0s)');
test_invalid_length_percentage('round(0px, 0deg)');
test_invalid_length_percentage('round(0px, 0Hz)');
test_invalid_length_percentage('round(0px, 0dpi)');
test_invalid_length_percentage('round(0px, 0fr)');
test_invalid_length_percentage('mod(0px, 0s)');
test_invalid_length_percentage('mod(0px, 0deg)');
test_invalid_length_percentage('mod(0px, 0Hz)');
test_invalid_length_percentage('mod(0px, 0dpi)');
test_invalid_length_percentage('mod(0px, 0fr)');
test_invalid_length_percentage('rem(0px, 0s)');
test_invalid_length_percentage('rem(0px, 0deg)');
test_invalid_length_percentage('rem(0px, 0Hz)');
test_invalid_length_percentage('rem(0px, 0dpi)');
test_invalid_length_percentage('rem(0px, 0fr)');
</script>
|