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 <div id="testElement"></div> | 5 <div id="testElement"></div> |
6 | 6 |
7 <script> | 7 <script> |
8 | 8 |
9 var computedStyleMap = getComputedStyleMap(testElement); | 9 var computedStyleMap = getComputedStyleMap(testElement); |
10 var computedStyle = getComputedStyle(testElement); | 10 var computedStyle = getComputedStyle(testElement); |
(...skipping 10 matching lines...) Expand all Loading... |
21 }, "Computed StyleMap.getProperties returns the same number of properties as Com
putedStyle"); | 21 }, "Computed StyleMap.getProperties returns the same number of properties as Com
putedStyle"); |
22 | 22 |
23 test(function() { | 23 test(function() { |
24 var properties = computedStyleMap.getProperties(); | 24 var properties = computedStyleMap.getProperties(); |
25 for (var i = 0; i < properties.length; i++) { | 25 for (var i = 0; i < properties.length; i++) { |
26 var property = properties[i]; | 26 var property = properties[i]; |
27 var styleValues = computedStyleMap.getAll(property); | 27 var styleValues = computedStyleMap.getAll(property); |
28 if (styleValues.length == 1) { | 28 if (styleValues.length == 1) { |
29 // TODO(meade): Remove this if statement once all properties are supported
. | 29 // TODO(meade): Remove this if statement once all properties are supported
. |
30 // TODO(meade): Handle sequence types. | 30 // TODO(meade): Handle sequence types. |
31 assert_equals(computedStyleMap.get(property).cssString, computedStyle[prop
erty]); | 31 assert_equals(computedStyleMap.get(property).cssText, computedStyle[proper
ty]); |
32 } | 32 } |
33 } | 33 } |
34 }, 'Properties retrieved from ComputedStyleMap reflect the same values as from C
omputedStyle'); | 34 }, 'Properties retrieved from ComputedStyleMap reflect the same values as from C
omputedStyle'); |
35 | 35 |
36 test(function() { | 36 test(function() { |
37 testElement.style.border = '1px solid #00ff00'; | 37 testElement.style.border = '1px solid #00ff00'; |
38 var styleValue = computedStyleMap.get('border'); | 38 var styleValue = computedStyleMap.get('border'); |
39 assert_equals(styleValue.constructor, CSSStyleValue); | 39 assert_equals(styleValue.constructor, CSSStyleValue); |
40 assert_equals(styleValue.cssString, testElement.style.border); | 40 assert_equals(styleValue.cssText, testElement.style.border); |
41 }, 'Unsupported but serializable property returns a base CSSStyleValue.'); | 41 }, 'Unsupported but serializable property returns a base CSSStyleValue.'); |
42 | 42 |
43 test(function() { | 43 test(function() { |
44 testElement.style.border = ''; | 44 testElement.style.border = ''; |
45 testElement.style.borderBottomColor = 'green'; | 45 testElement.style.borderBottomColor = 'green'; |
46 assert_equals(computedStyleMap.get('border'), null); | 46 assert_equals(computedStyleMap.get('border'), null); |
47 }, 'Unsupported and unserializable property returns null.'); | 47 }, 'Unsupported and unserializable property returns null.'); |
48 | 48 |
49 test(function() { | 49 test(function() { |
50 assert_false(computedStyleMap.has('max-zoom')); | 50 assert_false(computedStyleMap.has('max-zoom')); |
(...skipping 12 matching lines...) Expand all Loading... |
63 testElement.style.border = ''; | 63 testElement.style.border = ''; |
64 testElement.style.borderTopColor = 'red'; | 64 testElement.style.borderTopColor = 'red'; |
65 assert_false(computedStyleMap.has('border')); | 65 assert_false(computedStyleMap.has('border')); |
66 }, 'has() return false for unsupported and unserializable shorthand properties.'
); | 66 }, 'has() return false for unsupported and unserializable shorthand properties.'
); |
67 | 67 |
68 test(function() { | 68 test(function() { |
69 assert_true(computedStyleMap.has('width')); | 69 assert_true(computedStyleMap.has('width')); |
70 }, 'has() returns true for a supported property.'); | 70 }, 'has() returns true for a supported property.'); |
71 | 71 |
72 </script> | 72 </script> |
OLD | NEW |