| 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 16 matching lines...) Expand all Loading... |
| 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).cssString, computedStyle[prop
erty]); |
| 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'; |
| 38 var styleValue = computedStyleMap.get('border'); |
| 39 assert_equals(styleValue.constructor, CSSStyleValue); |
| 40 assert_equals(styleValue.cssString, testElement.style.border); |
| 41 }, 'Unsupported but serializable property returns a base CSSStyleValue.'); |
| 42 |
| 43 test(function() { |
| 44 testElement.style.border = ''; |
| 45 testElement.style.borderBottomColor = 'green'; |
| 46 assert_equals(computedStyleMap.get('border'), null); |
| 47 }, 'Unsupported and unserializable property returns null.'); |
| 48 |
| 49 test(function() { |
| 37 assert_false(computedStyleMap.has('max-zoom')); | 50 assert_false(computedStyleMap.has('max-zoom')); |
| 38 }, 'has() return false for an unsupported property.'); | 51 }, 'has() return false for an unsupported property.'); |
| 39 | 52 |
| 40 test(function() { | 53 test(function() { |
| 41 assert_throws(null, function() { computedStyleMap.has('bananas'); }); | 54 assert_throws(null, function() { computedStyleMap.has('bananas'); }); |
| 42 }, 'has() throws for an invalid property.'); | 55 }, 'has() throws for an invalid property.'); |
| 43 | 56 |
| 44 test(function() { | 57 test(function() { |
| 58 testElement.style.border = '1px solid black'; |
| 59 assert_true(computedStyleMap.has('border')); |
| 60 }, 'has() returns true for an unsupported but serializable shorthand property.')
; |
| 61 |
| 62 test(function() { |
| 63 testElement.style.border = ''; |
| 64 testElement.style.borderTopColor = 'red'; |
| 45 assert_false(computedStyleMap.has('border')); | 65 assert_false(computedStyleMap.has('border')); |
| 46 }, 'has() return false for unsupported shorthand properties.'); | 66 }, 'has() return false for unsupported and unserializable shorthand properties.'
); |
| 47 | 67 |
| 48 test(function() { | 68 test(function() { |
| 49 assert_true(computedStyleMap.has('width')); | 69 assert_true(computedStyleMap.has('width')); |
| 50 }, 'has() returns true for a supported property.'); | 70 }, 'has() returns true for a supported property.'); |
| 51 | 71 |
| 52 </script> | 72 </script> |
| OLD | NEW |