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_false(computedStyleMap.has('max-zoom')); | 40 assert_throws(null, function() { computedStyleMap.get('bananas'); }); |
| 41 }, 'get() throws for an invalid property.'); |
| 42 |
| 43 test(function() { |
| 44 assert_false(computedStyleMap.has('-webkit-mask')); |
41 }, 'has() return false for an unsupported property.'); | 45 }, 'has() return false for an unsupported property.'); |
42 | 46 |
43 test(function() { | 47 test(function() { |
44 assert_throws(null, function() { computedStyleMap.has('bananas'); }); | 48 assert_throws(null, function() { computedStyleMap.has('bananas'); }); |
45 }, 'has() throws for an invalid property.'); | 49 }, 'has() throws for an invalid property.'); |
46 | 50 |
47 test(function() { | 51 test(function() { |
48 testElement.style.border = '1px solid black'; | 52 testElement.style.border = '1px solid black'; |
49 assert_true(computedStyleMap.has('border')); | 53 assert_true(computedStyleMap.has('border')); |
50 }, 'has() returns true for an unsupported but serializable shorthand property.')
; | 54 }, 'has() returns true for an unsupported but serializable shorthand property.')
; |
51 | 55 |
52 test(function() { | 56 test(function() { |
53 testElement.style.border = ''; | 57 testElement.style.border = ''; |
54 testElement.style.borderTopColor = 'red'; | 58 testElement.style.borderTopColor = 'red'; |
55 assert_false(computedStyleMap.has('border')); | 59 assert_false(computedStyleMap.has('border')); |
56 }, 'has() return false for unsupported and unserializable shorthand properties.'
); | 60 }, 'has() return false for unsupported and unserializable shorthand properties.'
); |
57 | 61 |
58 test(function() { | 62 test(function() { |
59 assert_true(computedStyleMap.has('width')); | 63 assert_true(computedStyleMap.has('width')); |
60 }, 'has() returns true for a supported property.'); | 64 }, 'has() returns true for a supported property.'); |
61 | 65 |
| 66 test(function() { |
| 67 testElement.style.width = '100px'; |
| 68 assert_equals(computedStyleMap.get('width').cssText, '100px'); |
| 69 testElement.style.display = 'none'; |
| 70 assert_equals(computedStyleMap.get('width').cssText, '100px'); |
| 71 }, 'get() returns correct values for an element with display: none.'); |
| 72 |
62 </script> | 73 </script> |
OLD | NEW |