2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
5 function assertParsedValue(property, input, expected) {
6 var style = document.createElement('div').style;
7 style.setProperty(property, input);
8 assert_equals(style.getPropertyValue(property), expected, property + ': ' + input);
12 assertParsedValue('-webkit-box-ordinal-group', 'calc(6 + 4)', '10');
13 assertParsedValue('-webkit-box-ordinal-group', 'calc(0)', null);
14 assertParsedValue('-webkit-column-span', 'calc(2 - 1)', null);
15 assertParsedValue('-webkit-column-span', 'calc(1 + 2)', null);
16 assertParsedValue('-webkit-column-width', 'calc(1em - 1px)', 'calc(1em - 1px)');
17 assertParsedValue('transition-timing-function', 'cubic-bezier(calc(1 + 2), 0, 1, 1)', null);
18 assertParsedValue('transition-timing-function', 'cubic-bezier(calc(1 / 2), calc(1 - 1), calc(2 - 1), calc(2 * 3))', 'cubic-bezier(0.5, 0, 1, 6)');
19 assertParsedValue('transition-timing-function', 'steps(calc(1 + 2), start)', 'steps(3, start)');
20 assertParsedValue('grid-row-start', 'calc(1 + 2) test', '3 test');
21 assertParsedValue('grid-row-start', 'calc(1 / 2) test', null);
22 assertParsedValue('font-weight', 'calc(100 + 200)', null);
23 assertParsedValue('flex', 'calc(1 + 2) calc(3 + 4)', '3 7 0%');
24 assertParsedValue('-webkit-aspect-ratio', 'calc(1 + 2)/calc(3 + 4)', '3/7');
25 assertParsedValue('-webkit-filter', 'saturate(calc(4 / 2))', 'saturate(2)');
26 assertParsedValue('-webkit-filter', 'invert(calc(4 / 2))', null);
27 assertParsedValue('-webkit-filter', 'invert(calc(2 / 4))', 'invert(0.5)');
28 assertParsedValue('-webkit-filter', 'brightness(calc(4 / 2))', 'brightness(2)');
29 }, 'Ensure using calc() for CSS numbers does not crash or produce incorrect values.');