OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <style> | 4 <style> |
5 * { font-size: 16px; } | 5 * { font-size: 16px; } |
6 div { font-size: 8px; } | 6 div { font-size: 8px; } |
7 </style> | 7 </style> |
8 <script src="../../../resources/js-test.js"></script> | 8 <script src="../../../resources/js-test.js"></script> |
9 </head> | 9 </head> |
10 <body> | 10 <body> |
11 <script src="parsing-test-utils.js"></script> | 11 <script src="parsing-test-utils.js"></script> |
12 <script> | 12 <script> |
13 description('Test that basic shapes accept different length units'); | 13 description('Test that basic shapes accept different length units'); |
14 | 14 |
15 // The test functions and globals used here are defined parsing-test-utils.js. | 15 // The test functions and globals used here are defined parsing-test-utils.js. |
16 | 16 |
17 function getStyleValue(property, value) { | 17 function getStyleValue(property, value) { |
18 var div = document.createElement("div"); | 18 var div = document.createElement("div"); |
19 div.style.setProperty(property, value); | 19 div.style.setProperty(property, value); |
20 return div.style.getPropertyValue(property); | 20 return div.style.getPropertyValue(property); |
21 } | 21 } |
22 | 22 |
23 function testStyleValue(value, expected) { | 23 function testStyleValue(value, expected) { |
24 if (expected === null) | 24 if (expected === null) |
25 shouldBeNull('getStyleValue("shape-inside", "' + value + '")'); | 25 shouldBeNull('getStyleValue("shape-outside", "' + value + '")'); |
26 else | 26 else |
27 shouldBeEqualToString('getStyleValue("shape-inside", "' + value + '")',
expected); | 27 shouldBeEqualToString('getStyleValue("shape-outside", "' + value + '")',
expected); |
28 } | 28 } |
29 function testComputedStyleValue(value, expected) { | 29 function testComputedStyleValue(value, expected) { |
30 testShapeComputedProperty("shape-inside", value, expected); | 30 testShapeComputedProperty("shape-outside", value, expected); |
31 } | 31 } |
32 | 32 |
33 function testInvalidValue(property, value) { | 33 function testInvalidValue(property, value) { |
34 testStyleValue(value, null); | 34 testStyleValue(value, null); |
35 testComputedStyleValue(value, 'none'); | 35 testComputedStyleValue(value, 'none'); |
36 } | 36 } |
37 | 37 |
38 // absolute lengths - number serialization, units | 38 // absolute lengths - number serialization, units |
39 testStyleValue("circle(0 at 0 0)", "circle(0px at 0% 0%)"); | 39 testStyleValue("circle(0 at 0 0)", "circle(0px at 0% 0%)"); |
40 testStyleValue("circle(1px at +1px -1px)", "circle(1px at 1px -1px)"); | 40 testStyleValue("circle(1px at +1px -1px)", "circle(1px at 1px -1px)"); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // reject negative radiuses | 88 // reject negative radiuses |
89 testInvalidValue("shape-outside", "circle(-1.5px at -1.5px +1.5px)"); | 89 testInvalidValue("shape-outside", "circle(-1.5px at -1.5px +1.5px)"); |
90 testInvalidValue("shape-outside", "inset(1cm 1mm 1in 1px round 1pt -1pc)"); | 90 testInvalidValue("shape-outside", "inset(1cm 1mm 1in 1px round 1pt -1pc)"); |
91 testInvalidValue("shape-outside", "ellipse(-1em 1em at 1em 1em)"); | 91 testInvalidValue("shape-outside", "ellipse(-1em 1em at 1em 1em)"); |
92 testInvalidValue("shape-outside", "ellipse(1em -1em at 1em 1em)"); | 92 testInvalidValue("shape-outside", "ellipse(1em -1em at 1em 1em)"); |
93 | 93 |
94 </script> | 94 </script> |
95 </body> | 95 </body> |
96 </html> | 96 </html> |
OLD | NEW |