OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/testharness.js"></script> | 2 <script src="../resources/testharness.js"></script> |
3 <script src="../resources/testharnessreport.js"></script> | 3 <script src="../resources/testharnessreport.js"></script> |
4 <div id="target" style="width: 100px; height: 200px; display: inline-block"></di
v> | 4 <div id="target" style="width: 100px; height: 200px; display: inline-block"></di
v> |
5 <script src="resources/parsing-test-helper.js"></script> | 5 <script src="resources/parsing-test-helper.js"></script> |
6 <script> | 6 <script> |
7 expect = expect.bind(this, 'scale', 'scale'); | 7 expect = expect.bind(this, 'scale', 'scale'); |
8 | 8 |
9 expect('initial').parsesAs('initial').isComputedTo('1'); | 9 expect('initial').parsesAs('initial').isComputedTo('1'); |
10 expect('inherit').parsesAs('inherit'); | 10 expect('inherit').parsesAs('inherit'); |
11 | 11 |
12 expect('1').parsesAs('1').isComputedTo('1'); | 12 expect('1').parsesAs('1').isComputedTo('1'); |
13 expect('1 -2.3').parsesAs('1 -2.3').isComputedTo('1 -2.3'); | 13 expect('1 -2.3').parsesAs('1 -2.3').isComputedTo('1 -2.3'); |
14 expect('1 -2.3 4').parsesAs('1 -2.3 4').isComputedTo('1 -2.3 4'); | 14 expect('1 -2.3 4').parsesAs('1 -2.3 4').isComputedTo('1 -2.3 4'); |
15 | 15 |
16 /* Note this assumes that scaling with 1 number applies to both x and y axis */ | 16 /* Note this assumes that scaling with 1 number applies to both x and y axis */ |
17 expect('calc(1 * 2)').parsesAs('2').isComputedTo('2 2'); | 17 expect('calc(1 * 2)').parsesAs('2').isComputedTo('2'); |
18 expect('calc(1 * 2) calc(2 / 4)').parsesAs('2 0.5').isComputedTo('2 0.5'); | 18 expect('calc(1 * 2) calc(2 / 4)').parsesAs('2 0.5').isComputedTo('2 0.5'); |
19 expect('calc(1 * 2) calc(2 / 4) calc(0.5)').parsesAs('2 0.5 0.5').isComputedTo('
2 0.5 0.5'); | 19 expect('calc(1 * 2) calc(2 / 4) calc(0.5)').parsesAs('2 0.5 0.5').isComputedTo('
2 0.5 0.5'); |
20 | 20 |
21 expect('2px').isInvalid(); | 21 expect('2px').isInvalid(); |
22 expect('30%').isInvalid(); | 22 expect('30%').isInvalid(); |
23 expect('1 1 1 1').isInvalid(); | 23 expect('1 1 1 1').isInvalid(); |
24 expect('1 2 3deg').isInvalid(); | 24 expect('1 2 3deg').isInvalid(); |
25 expect('1 + 1').isInvalid(); | 25 expect('1 + 1').isInvalid(); |
26 expect('1,').isInvalid(); | 26 expect('1,').isInvalid(); |
27 expect('1, 2,').isInvalid(); | 27 expect('1, 2,').isInvalid(); |
28 expect('calc(1 * 2 + 4px) calc(2 / 4) calc(0.5)').isInvalid(); | 28 expect('calc(1 * 2 + 4px) calc(2 / 4) calc(0.5)').isInvalid(); |
29 expect('calc(1 * 2) calc(2 / 4 * 4deg) calc(0.5)').isInvalid(); | 29 expect('calc(1 * 2) calc(2 / 4 * 4deg) calc(0.5)').isInvalid(); |
30 expect('calc(1 * 2) calc(2 / 4) calc(0.5%)').isInvalid(); | 30 expect('calc(1 * 2) calc(2 / 4) calc(0.5%)').isInvalid(); |
31 </script> | 31 </script> |
OLD | NEW |