Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Gap Decorations: rule-inset shorthands</title>
<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 = {
'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-cap-start', 'row-rule-inset-cap-end',
'row-rule-inset-junction-start', 'row-rule-inset-junction-end']
};
const bidirectionalTestCases = [
{
input: '0px',
expected: {
columnRuleInsetCapStart: '0px',
columnRuleInsetCapEnd: '0px',
columnRuleInsetJunctionStart: '0px',
columnRuleInsetJunctionEnd: '0px',
rowRuleInsetCapStart: '0px',
rowRuleInsetCapEnd: '0px',
rowRuleInsetJunctionStart: '0px',
rowRuleInsetJunctionEnd: '0px'
}
},
{
input: '10px',
expected: {
columnRuleInsetCapStart: '10px',
columnRuleInsetCapEnd: '10px',
columnRuleInsetJunctionStart: '10px',
columnRuleInsetJunctionEnd: '10px',
rowRuleInsetCapStart: '10px',
rowRuleInsetCapEnd: '10px',
rowRuleInsetJunctionStart: '10px',
rowRuleInsetJunctionEnd: '10px'
}
},
{
input: '50%',
expected: {
columnRuleInsetCapStart: '50%',
columnRuleInsetCapEnd: '50%',
columnRuleInsetJunctionStart: '50%',
columnRuleInsetJunctionEnd: '50%',
rowRuleInsetCapStart: '50%',
rowRuleInsetCapEnd: '50%',
rowRuleInsetJunctionStart: '50%',
rowRuleInsetJunctionEnd: '50%',
}
},
{
input: '10px 20px',
expected: {
columnRuleInsetCapStart: '10px',
columnRuleInsetCapEnd: '20px',
columnRuleInsetJunctionStart: '10px',
columnRuleInsetJunctionEnd: '20px',
rowRuleInsetCapStart: '10px',
rowRuleInsetCapEnd: '20px',
rowRuleInsetJunctionStart: '10px',
rowRuleInsetJunctionEnd: '20px',
}
},
{
input: '10px 20px / 30px',
expected: {
columnRuleInsetCapStart: '10px',
columnRuleInsetCapEnd: '20px',
columnRuleInsetJunctionStart: '30px',
columnRuleInsetJunctionEnd: '30px',
rowRuleInsetCapStart: '10px',
rowRuleInsetCapEnd: '20px',
rowRuleInsetJunctionStart: '30px',
rowRuleInsetJunctionEnd: '30px',
}
},
{
input: '10px / 20px 30px',
expected: {
columnRuleInsetCapStart: '10px',
columnRuleInsetCapEnd: '10px',
columnRuleInsetJunctionStart: '20px',
columnRuleInsetJunctionEnd: '30px',
rowRuleInsetCapStart: '10px',
rowRuleInsetCapEnd: '10px',
rowRuleInsetJunctionStart: '20px',
rowRuleInsetJunctionEnd: '30px',
}
},
{
input: '10px 20px / 30px 40px',
expected: {
columnRuleInsetCapStart: '10px',
columnRuleInsetCapEnd: '20px',
columnRuleInsetJunctionStart: '30px',
columnRuleInsetJunctionEnd: '40px',
rowRuleInsetCapStart: '10px',
rowRuleInsetCapEnd: '20px',
rowRuleInsetJunctionStart: '30px',
rowRuleInsetJunctionEnd: '40px',
}
},
{
input: 'overlap-join',
expected: {
columnRuleInsetCapStart: 'overlap-join',
columnRuleInsetCapEnd: 'overlap-join',
columnRuleInsetJunctionStart: 'overlap-join',
columnRuleInsetJunctionEnd: 'overlap-join',
rowRuleInsetCapStart: 'overlap-join',
rowRuleInsetCapEnd: 'overlap-join',
rowRuleInsetJunctionStart: 'overlap-join',
rowRuleInsetJunctionEnd: 'overlap-join',
}
},
{
input: 'overlap-join 10px / overlap-join 10px',
expected: {
columnRuleInsetCapStart: 'overlap-join',
columnRuleInsetCapEnd: '10px',
columnRuleInsetJunctionStart: 'overlap-join',
columnRuleInsetJunctionEnd: '10px',
rowRuleInsetCapStart: 'overlap-join',
rowRuleInsetCapEnd: '10px',
rowRuleInsetJunctionStart: 'overlap-join',
rowRuleInsetJunctionEnd: '10px',
}
},
];
for (rule_property in rule_properties) {
const test_cases = bidirectionalTestCases;
for (const { input, expected } of test_cases) {
const [columnRuleInsetCapStart, columnRuleInsetCapEnd, columnRuleInsetJunctionStart, columnRuleInsetJunctionEnd, rowRuleInsetCapStart, rowRuleInsetCapEnd, rowRuleInsetJunctionStart, rowRuleInsetJunctionEnd] = rule_properties[rule_property];
test_shorthand_value(rule_property, input, {
[columnRuleInsetCapStart]: expected.columnRuleInsetCapStart,
[columnRuleInsetCapEnd]: expected.columnRuleInsetCapEnd,
[columnRuleInsetJunctionStart]: expected.columnRuleInsetJunctionStart,
[columnRuleInsetJunctionEnd]: expected.columnRuleInsetJunctionEnd,
[rowRuleInsetCapStart]: expected.rowRuleInsetCapStart,
[rowRuleInsetCapEnd]: expected.rowRuleInsetCapEnd,
[rowRuleInsetJunctionStart]: expected.rowRuleInsetJunctionStart,
[rowRuleInsetJunctionEnd]: expected.rowRuleInsetJunctionEnd,
});
}
}
</script>
</body>
</html>