| 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 = ''; |
| 11 assert_array_equals(testElement.styleMap.getProperties(), []); | 11 assert_array_equals(testElement.styleMap.getProperties(), []); |
| 12 }, "getProperties returns an empty list when no properties have been set"); | 12 }, "getProperties returns an empty list when no properties have been set"); |
| 13 | 13 |
| 14 test(function() { | 14 test(function() { |
| 15 testElement.style = ''; | 15 testElement.style = ''; |
| 16 testElement.styleMap.set('width', new CSSSimpleLength(10, 'px')); | 16 testElement.styleMap.set('width', new CSSUnitValue(10, 'px')); |
| 17 assert_array_equals(testElement.styleMap.getProperties(), ['width']); | 17 assert_array_equals(testElement.styleMap.getProperties(), ['width']); |
| 18 }, "getProperties returns the name of a property if it is set"); | 18 }, "getProperties returns the name of a property if it is set"); |
| 19 | 19 |
| 20 test(function() { | 20 test(function() { |
| 21 testElement.styleMap.set('width', new CSSSimpleLength(10, 'px')); | 21 testElement.styleMap.set('width', new CSSUnitValue(10, 'px')); |
| 22 assert_array_equals(testElement.styleMap.getProperties(), ['width']); | 22 assert_array_equals(testElement.styleMap.getProperties(), ['width']); |
| 23 | 23 |
| 24 testElement.styleMap.get('height'); | 24 testElement.styleMap.get('height'); |
| 25 assert_array_equals(testElement.styleMap.getProperties(), ['width']); | 25 assert_array_equals(testElement.styleMap.getProperties(), ['width']); |
| 26 }, "Accessing another property doesn't add a spurious result"); | 26 }, "Accessing another property doesn't add a spurious result"); |
| 27 | 27 |
| 28 test(function() { | 28 test(function() { |
| 29 testElement.styleMap.set('width', new CSSSimpleLength(10, 'px')); | 29 testElement.styleMap.set('width', new CSSUnitValue(10, 'px')); |
| 30 assert_array_equals(testElement.styleMap.getProperties(), ['width']); | 30 assert_array_equals(testElement.styleMap.getProperties(), ['width']); |
| 31 | 31 |
| 32 testElement.styleMap.delete('width'); | 32 testElement.styleMap.delete('width'); |
| 33 assert_array_equals(testElement.styleMap.getProperties(), []); | 33 assert_array_equals(testElement.styleMap.getProperties(), []); |
| 34 }, "property name does not appear in result after deletion"); | 34 }, "property name does not appear in result after deletion"); |
| 35 | 35 |
| 36 test(function() { | 36 test(function() { |
| 37 testElement.styleMap.set('width', new CSSSimpleLength(10, 'px')); | 37 testElement.styleMap.set('width', new CSSUnitValue(10, 'px')); |
| 38 assert_array_equals(testElement.styleMap.getProperties(), ['width']); | 38 assert_array_equals(testElement.styleMap.getProperties(), ['width']); |
| 39 | 39 |
| 40 testElement.styleMap.set('border-top-width', new CSSSimpleLength(10, 'px')); | 40 testElement.styleMap.set('border-top-width', new CSSUnitValue(10, 'px')); |
| 41 var result = testElement.styleMap.getProperties(); | 41 var result = testElement.styleMap.getProperties(); |
| 42 // TODO(meade): The spec should describe an order for this. | 42 // TODO(meade): The spec should describe an order for this. |
| 43 assert_equals(result.length, 2); | 43 assert_equals(result.length, 2); |
| 44 assert_true(result.indexOf('width') >= 0); | 44 assert_true(result.indexOf('width') >= 0); |
| 45 assert_true(result.indexOf('border-top-width') >= 0); | 45 assert_true(result.indexOf('border-top-width') >= 0); |
| 46 }, "getProperties returns multiple properties if they are set."); | 46 }, "getProperties returns multiple properties if they are set."); |
| 47 | 47 |
| 48 test(function() { | 48 test(function() { |
| 49 testElement.style = ''; | 49 testElement.style = ''; |
| 50 testElement.style.setProperty('--my-custom-property', '5px'); | 50 testElement.style.setProperty('--my-custom-property', '5px'); |
| 51 | 51 |
| 52 assert_array_equals(testElement.styleMap.getProperties(), ['--my-custom-proper
ty']); | 52 assert_array_equals(testElement.styleMap.getProperties(), ['--my-custom-proper
ty']); |
| 53 }, "getProperties returns expected values for custom properties"); | 53 }, "getProperties returns expected values for custom properties"); |
| 54 | 54 |
| 55 test(function() { | 55 test(function() { |
| 56 testElement.style.cssText = "@apply --foo"; | 56 testElement.style.cssText = "@apply --foo"; |
| 57 assert_array_equals(testElement.styleMap.getProperties(), ['@apply']); | 57 assert_array_equals(testElement.styleMap.getProperties(), ['@apply']); |
| 58 }, "getProperties returns expected values when @apply is used"); | 58 }, "getProperties returns expected values when @apply is used"); |
| 59 | 59 |
| 60 test(function() { | 60 test(function() { |
| 61 testElement.style.cssText = "@apply --foo; @apply --bar;"; | 61 testElement.style.cssText = "@apply --foo; @apply --bar;"; |
| 62 assert_array_equals(testElement.styleMap.getProperties(), ['@apply']); | 62 assert_array_equals(testElement.styleMap.getProperties(), ['@apply']); |
| 63 }, "getProperties returns only one @apply when multiple things are applied"); | 63 }, "getProperties returns only one @apply when multiple things are applied"); |
| 64 | 64 |
| 65 </script> | 65 </script> |
| OLD | NEW |