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 // TODO(meade): Make this a test case for a property with multiple values when
that is supported. | 10 // TODO(meade): Make this a test case for a property with multiple values when
that is supported. |
11 testElement.styleMap.set('width', new CSSSimpleLength(90, 'px')); | 11 testElement.styleMap.set('width', new CSSUnitValue(90, 'px')); |
12 var result = testElement.styleMap.getAll('width'); | 12 var result = testElement.styleMap.getAll('width'); |
13 assert_equals(result.length, 1); | 13 assert_equals(result.length, 1); |
14 assert_equals(result[0].cssText, '90px'); | 14 assert_equals(result[0].cssText, '90px'); |
15 }, "getAll() returns a list of values"); | 15 }, "getAll() returns a list of values"); |
16 | 16 |
17 test(function() { | 17 test(function() { |
18 testElement.styleMap.set('width', new CSSSimpleLength(100, 'px')); | 18 testElement.styleMap.set('width', new CSSUnitValue(100, 'px')); |
19 var lowerResult = testElement.styleMap.getAll('width'); | 19 var lowerResult = testElement.styleMap.getAll('width'); |
20 var upperResult = testElement.styleMap.getAll('WIDTH'); | 20 var upperResult = testElement.styleMap.getAll('WIDTH'); |
21 var mixedResult = testElement.styleMap.getAll('wIdTh'); | 21 var mixedResult = testElement.styleMap.getAll('wIdTh'); |
22 | 22 |
23 assert_equals(lowerResult.length, 1); | 23 assert_equals(lowerResult.length, 1); |
24 assert_equals(upperResult.length, 1); | 24 assert_equals(upperResult.length, 1); |
25 assert_equals(mixedResult.length, 1); | 25 assert_equals(mixedResult.length, 1); |
26 assert_equals(lowerResult[0].cssText, '100px'); | 26 assert_equals(lowerResult[0].cssText, '100px'); |
27 assert_equals(upperResult[0].cssText, '100px'); | 27 assert_equals(upperResult[0].cssText, '100px'); |
28 assert_equals(mixedResult[0].cssText, '100px'); | 28 assert_equals(mixedResult[0].cssText, '100px'); |
29 }, "getAll is case-insensitive for the property name"); | 29 }, "getAll is case-insensitive for the property name"); |
30 | 30 |
31 test(function() { | 31 test(function() { |
32 assert_array_equals(testElement.styleMap.getAll('height'), []); | 32 assert_array_equals(testElement.styleMap.getAll('height'), []); |
33 }, "getAll() returns an empty list if the property isn't set"); | 33 }, "getAll() returns an empty list if the property isn't set"); |
34 | 34 |
35 test(function() { | 35 test(function() { |
36 assert_throws(new TypeError(), function() { | 36 assert_throws(new TypeError(), function() { |
37 testElement.styleMap.getAll('lemons'); | 37 testElement.styleMap.getAll('lemons'); |
38 }); | 38 }); |
39 }, "getAll() throws if you try to get an invalid property"); | 39 }, "getAll() throws if you try to get an invalid property"); |
40 | 40 |
41 </script> | 41 </script> |
OLD | NEW |