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 test(function() { | 9 test(function() { |
10 testElement.style = ""; | 10 testElement.style = ""; |
(...skipping 10 matching lines...) Expand all Loading... |
21 test(function() { | 21 test(function() { |
22 testElement.style = "width: 50px"; | 22 testElement.style = "width: 50px"; |
23 | 23 |
24 var iterator = testElement.styleMap.entries(); | 24 var iterator = testElement.styleMap.entries(); |
25 var entry = iterator.next(); | 25 var entry = iterator.next(); |
26 assert_false(entry.done); | 26 assert_false(entry.done); |
27 // Should only be one entry. | 27 // Should only be one entry. |
28 assert_true(iterator.next().done); | 28 assert_true(iterator.next().done); |
29 | 29 |
30 assert_equals(entry.value[0], 'width'); | 30 assert_equals(entry.value[0], 'width'); |
31 assert_equals(entry.value[1].constructor.name, CSSSimpleLength.name); | 31 assert_equals(entry.value[1].constructor.name, CSSUnitValue.name); |
32 assert_equals(entry.value[1].cssText, '50px'); | 32 assert_equals(entry.value[1].cssText, '50px'); |
33 }, "Iterator for single entry returns iterator with a single value"); | 33 }, "Iterator for single entry returns iterator with a single value"); |
34 | 34 |
35 test(function() { | 35 test(function() { |
36 testElement.style = "width: 60px"; | 36 testElement.style = "width: 60px"; |
37 | 37 |
38 var iterator = testElement.styleMap.keys(); | 38 var iterator = testElement.styleMap.keys(); |
39 var entry = iterator.next(); | 39 var entry = iterator.next(); |
40 assert_false(entry.done); | 40 assert_false(entry.done); |
41 // Should only be one entry. | 41 // Should only be one entry. |
42 assert_true(iterator.next().done); | 42 assert_true(iterator.next().done); |
43 | 43 |
44 assert_equals(entry.value, 'width'); | 44 assert_equals(entry.value, 'width'); |
45 }, "Iterator for single key returns iterator with a single value"); | 45 }, "Iterator for single key returns iterator with a single value"); |
46 | 46 |
47 test(function() { | 47 test(function() { |
48 testElement.style = "width: 70px"; | 48 testElement.style = "width: 70px"; |
49 | 49 |
50 var iterator = testElement.styleMap.values(); | 50 var iterator = testElement.styleMap.values(); |
51 var entry = iterator.next(); | 51 var entry = iterator.next(); |
52 assert_false(entry.done); | 52 assert_false(entry.done); |
53 // Should only be one entry. | 53 // Should only be one entry. |
54 assert_true(iterator.next().done); | 54 assert_true(iterator.next().done); |
55 | 55 |
56 assert_equals(entry.value.constructor.name, CSSSimpleLength.name); | 56 assert_equals(entry.value.constructor.name, CSSUnitValue.name); |
57 assert_equals(entry.value.cssText, '70px'); | 57 assert_equals(entry.value.cssText, '70px'); |
58 }, "Iterator for single value returns iterator with a single value"); | 58 }, "Iterator for single value returns iterator with a single value"); |
59 | 59 |
60 test(function() { | 60 test(function() { |
61 testElement.style = "border: 5px solid lightcoral"; | 61 testElement.style = "border: 5px solid lightcoral"; |
62 | 62 |
63 var entries = {}; | 63 var entries = {}; |
64 var numEntries = 0; | 64 var numEntries = 0; |
65 for (let value of testElement.styleMap.entries()) { | 65 for (let value of testElement.styleMap.entries()) { |
66 numEntries++; | 66 numEntries++; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 assert_equals(entries.length, 1); | 123 assert_equals(entries.length, 1); |
124 var propertyAndValue = entries[0]; | 124 var propertyAndValue = entries[0]; |
125 assert_equals(propertyAndValue.length, 2); | 125 assert_equals(propertyAndValue.length, 2); |
126 | 126 |
127 assert_equals(propertyAndValue[0], '@apply'); | 127 assert_equals(propertyAndValue[0], '@apply'); |
128 assert_equals(propertyAndValue[1].constructor, CSSStyleValue); | 128 assert_equals(propertyAndValue[1].constructor, CSSStyleValue); |
129 assert_equals(propertyAndValue[1].cssText, '--foo'); | 129 assert_equals(propertyAndValue[1].cssText, '--foo'); |
130 }, "@apply rules come out as CSSStyleValues"); | 130 }, "@apply rules come out as CSSStyleValues"); |
131 | 131 |
132 </script> | 132 </script> |
OLD | NEW |