| 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 19 matching lines...) Expand all Loading... |
| 30 assert_equals(styleValue.cssText, testElement.style.border); | 30 assert_equals(styleValue.cssText, testElement.style.border); |
| 31 }, 'Unsupported but serializable property returns a base CSSStyleValue.'); | 31 }, 'Unsupported but serializable property returns a base CSSStyleValue.'); |
| 32 | 32 |
| 33 test(function() { | 33 test(function() { |
| 34 testElement.style.border = ''; | 34 testElement.style.border = ''; |
| 35 testElement.style.borderBottomColor = 'green'; | 35 testElement.style.borderBottomColor = 'green'; |
| 36 assert_equals(computedStyleMap.get('border'), null); | 36 assert_equals(computedStyleMap.get('border'), null); |
| 37 }, 'Unsupported and unserializable property returns null.'); | 37 }, 'Unsupported and unserializable property returns null.'); |
| 38 | 38 |
| 39 test(function() { | 39 test(function() { |
| 40 assert_throws(null, function() { computedStyleMap.get('bananas'); }); | 40 assert_throws(new TypeError(), function() { computedStyleMap.get('bananas'); }
); |
| 41 }, 'get() throws for an invalid property.'); | 41 }, 'get() throws for an invalid property.'); |
| 42 | 42 |
| 43 test(function() { | 43 test(function() { |
| 44 assert_false(computedStyleMap.has('-webkit-mask')); | 44 assert_false(computedStyleMap.has('-webkit-mask')); |
| 45 }, 'has() return false for an unsupported property.'); | 45 }, 'has() return false for an unsupported property.'); |
| 46 | 46 |
| 47 test(function() { | 47 test(function() { |
| 48 assert_throws(null, function() { computedStyleMap.has('bananas'); }); | 48 assert_throws(new TypeError(), function() { computedStyleMap.has('bananas'); }
); |
| 49 }, 'has() throws for an invalid property.'); | 49 }, 'has() throws for an invalid property.'); |
| 50 | 50 |
| 51 test(function() { | 51 test(function() { |
| 52 testElement.style.border = '1px solid black'; | 52 testElement.style.border = '1px solid black'; |
| 53 assert_true(computedStyleMap.has('border')); | 53 assert_true(computedStyleMap.has('border')); |
| 54 }, 'has() returns true for an unsupported but serializable shorthand property.')
; | 54 }, 'has() returns true for an unsupported but serializable shorthand property.')
; |
| 55 | 55 |
| 56 test(function() { | 56 test(function() { |
| 57 testElement.style.border = ''; | 57 testElement.style.border = ''; |
| 58 testElement.style.borderTopColor = 'red'; | 58 testElement.style.borderTopColor = 'red'; |
| 59 assert_false(computedStyleMap.has('border')); | 59 assert_false(computedStyleMap.has('border')); |
| 60 }, 'has() return false for unsupported and unserializable shorthand properties.'
); | 60 }, 'has() return false for unsupported and unserializable shorthand properties.'
); |
| 61 | 61 |
| 62 test(function() { | 62 test(function() { |
| 63 assert_true(computedStyleMap.has('width')); | 63 assert_true(computedStyleMap.has('width')); |
| 64 }, 'has() returns true for a supported property.'); | 64 }, 'has() returns true for a supported property.'); |
| 65 | 65 |
| 66 test(function() { | 66 test(function() { |
| 67 testElement.style.width = '100px'; | 67 testElement.style.width = '100px'; |
| 68 assert_equals(computedStyleMap.get('width').cssText, '100px'); | 68 assert_equals(computedStyleMap.get('width').cssText, '100px'); |
| 69 testElement.style.display = 'none'; | 69 testElement.style.display = 'none'; |
| 70 assert_equals(computedStyleMap.get('width').cssText, '100px'); | 70 assert_equals(computedStyleMap.get('width').cssText, '100px'); |
| 71 }, 'get() returns correct values for an element with display: none.'); | 71 }, 'get() returns correct values for an element with display: none.'); |
| 72 | 72 |
| 73 </script> | 73 </script> |
| OLD | NEW |