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 | 4 |
5 <style> | 5 <style> |
6 #color { | 6 #color { |
7 --color-value: blue; | 7 --color-value: blue; |
| 8 --accordionColor:#0000ee; |
| 9 --foo:#1\.; |
8 background-color: var(--color-value); | 10 background-color: var(--color-value); |
9 } | 11 } |
10 | 12 |
11 #float_pixel { | 13 #float_pixel { |
12 --float-pixel-value: 10.5px; | 14 --float-pixel-value: 10.5px; |
13 border-width: var(--float-pixel-value); | 15 border-width: var(--float-pixel-value); |
14 } | 16 } |
15 | 17 |
16 #em { | 18 #em { |
17 --em-value: 1.5em; | 19 --em-value: 1.5em; |
(...skipping 17 matching lines...) Expand all Loading... |
35 <div id="percentage"></div> | 37 <div id="percentage"></div> |
36 <div id="dynamic"></div> | 38 <div id="dynamic"></div> |
37 </body> | 39 </body> |
38 | 40 |
39 <script> | 41 <script> |
40 test(function() { | 42 test(function() { |
41 assert_equals(getComputedStyle(color).backgroundColor, 'rgb(0, 0, 255)'); | 43 assert_equals(getComputedStyle(color).backgroundColor, 'rgb(0, 0, 255)'); |
42 }, 'background-color property, color value'); | 44 }, 'background-color property, color value'); |
43 | 45 |
44 test(function() { | 46 test(function() { |
| 47 assert_equals(getComputedStyle(color).getPropertyValue('--accordionColor'), '#
0000ee'); |
| 48 assert_equals(getComputedStyle(color).getPropertyValue('--foo'), '#1\\.'); |
| 49 }, 'property value, accordionColor, foo'); |
| 50 |
| 51 test(function() { |
45 assert_equals(getComputedStyle(float_pixel).borderWidth, '0px'); | 52 assert_equals(getComputedStyle(float_pixel).borderWidth, '0px'); |
46 }, 'border-width property, border-style = none'); | 53 }, 'border-width property, border-style = none'); |
47 | 54 |
48 float_pixel.style.borderStyle = "solid"; | 55 float_pixel.style.borderStyle = "solid"; |
49 test(function() { | 56 test(function() { |
50 assert_equals(getComputedStyle(float_pixel).borderWidth, '10px'); | 57 assert_equals(getComputedStyle(float_pixel).borderWidth, '10px'); |
51 }, 'border-width property, border-style = solid, floating point pixel value'); | 58 }, 'border-width property, border-style = solid, floating point pixel value'); |
52 | 59 |
53 test(function() { | 60 test(function() { |
54 assert_equals(getComputedStyle(em).fontSize, '24px'); | 61 assert_equals(getComputedStyle(em).fontSize, '24px'); |
55 }, 'font-size property, em value'); | 62 }, 'font-size property, em value'); |
56 | 63 |
57 test(function() { | 64 test(function() { |
58 assert_equals( | 65 assert_equals( |
59 getComputedStyle(percentage).width, parseInt(getComputedStyle(document.body)
.width) * 0.75 + 'px'); | 66 getComputedStyle(percentage).width, parseInt(getComputedStyle(document.body)
.width) * 0.75 + 'px'); |
60 }, 'width property, percentage value'); | 67 }, 'width property, percentage value'); |
61 | 68 |
62 test(function() { | 69 test(function() { |
63 assert_equals(getComputedStyle(dynamic).getPropertyValue("--custom-value"), ""
); | 70 assert_equals(getComputedStyle(dynamic).getPropertyValue("--custom-value"), ""
); |
64 dynamic.className = "dynamic"; | 71 dynamic.className = "dynamic"; |
65 assert_equals(getComputedStyle(dynamic).getPropertyValue("--custom-value"), "p
ass"); | 72 assert_equals(getComputedStyle(dynamic).getPropertyValue("--custom-value"), "p
ass"); |
66 }, 'custom property, forced style recalc'); | 73 }, 'custom property, forced style recalc'); |
67 </script> | 74 </script> |
OLD | NEW |