-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Expand file tree
/
Copy pathrule-inset-shorthand.html
More file actions
130 lines (127 loc) · 4.75 KB
/
Copy pathrule-inset-shorthand.html
File metadata and controls
130 lines (127 loc) · 4.75 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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Gap Decorations: rule-inset shorthands</title>
<link rel="help" href="https://www.w3.org/TR/css-gaps-1/#propdef-rule-inset">
<meta name="assert"
content="rule-inset supports the full grammar '<length-percentage> <length-percentage>? /[<length-percentage> <length-percentage>?]?'.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/shorthand-testcommon.js"></script>
</head>
<body>
<script>
const rule_properties = {
'column-rule-inset': ['column-rule-inset-cap-start', 'column-rule-inset-cap-end',
'column-rule-inset-junction-start', 'column-rule-inset-junction-end'],
'row-rule-inset': ['row-rule-inset-cap-start', 'row-rule-inset-cap-end',
'row-rule-inset-junction-start', 'row-rule-inset-junction-end']
};
const testCases = [
{
input: '0px',
expected: {
ruleInsetCapStart: '0px',
ruleInsetCapEnd: '0px',
ruleInsetJunctionStart: '0px',
ruleInsetJunctionEnd: '0px',
}
},
{
input: '10px',
expected: {
ruleInsetCapStart: '10px',
ruleInsetCapEnd: '10px',
ruleInsetJunctionStart: '10px',
ruleInsetJunctionEnd: '10px'
}
},
{
input: '50%',
expected: {
ruleInsetCapStart: '50%',
ruleInsetCapEnd: '50%',
ruleInsetJunctionStart: '50%',
ruleInsetJunctionEnd: '50%',
}
},
{
input: '10px 20px',
expected: {
ruleInsetCapStart: '10px',
ruleInsetCapEnd: '20px',
ruleInsetJunctionStart: '10px',
ruleInsetJunctionEnd: '20px',
}
},
{
input: '10px 20px / 30px',
expected: {
ruleInsetCapStart: '10px',
ruleInsetCapEnd: '20px',
ruleInsetJunctionStart: '30px',
ruleInsetJunctionEnd: '30px',
}
},
{
input: '10px / 20px 30px',
expected: {
ruleInsetCapStart: '10px',
ruleInsetCapEnd: '10px',
ruleInsetJunctionStart: '20px',
ruleInsetJunctionEnd: '30px',
}
},
{
input: '10px 20px / 30px 40px',
expected: {
ruleInsetCapStart: '10px',
ruleInsetCapEnd: '20px',
ruleInsetJunctionStart: '30px',
ruleInsetJunctionEnd: '40px',
}
},
{
input: 'overlap-join',
expected: {
ruleInsetCapStart: 'overlap-join',
ruleInsetCapEnd: 'overlap-join',
ruleInsetJunctionStart: 'overlap-join',
ruleInsetJunctionEnd: 'overlap-join',
}
},
{
input: 'overlap-join 10px / overlap-join 10px',
expected: {
ruleInsetCapStart: 'overlap-join',
ruleInsetCapEnd: '10px',
ruleInsetJunctionStart: 'overlap-join',
ruleInsetJunctionEnd: '10px',
}
},
{
input: '10px overlap-join / 10px overlap-join',
expected: {
ruleInsetCapStart: '10px',
ruleInsetCapEnd: 'overlap-join',
ruleInsetJunctionStart: '10px',
ruleInsetJunctionEnd: 'overlap-join',
}
},
];
for (rule_property in rule_properties) {
const test_cases = testCases;
for (const { input, expected } of test_cases) {
const [ruleInsetCapStart, ruleInsetCapEnd, ruleInsetJunctionStart, ruleInsetJunctionEnd] = rule_properties[rule_property];
test_shorthand_value(rule_property, input, {
[ruleInsetCapStart]: expected.ruleInsetCapStart,
[ruleInsetCapEnd]: expected.ruleInsetCapEnd,
[ruleInsetJunctionStart]: expected.ruleInsetJunctionStart,
[ruleInsetJunctionEnd]: expected.ruleInsetJunctionEnd,
});
}
}
</script>
</body>
</html>