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