| 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 // Delete | 9 // Delete |
| 10 test(function() { | 10 test(function() { |
| 11 testElement.style.width = '80px'; | 11 testElement.style.width = '80px'; |
| 12 assert_equals(testElement.styleMap.get('width').cssText, '80px'); | 12 assert_equals(testElement.styleMap.get('width').cssText, '80px'); |
| 13 | 13 |
| 14 testElement.styleMap.delete('width'); | 14 testElement.styleMap.delete('width'); |
| 15 assert_equals(testElement.styleMap.get('width'), null); | 15 assert_equals(testElement.styleMap.get('width'), null); |
| 16 assert_equals(testElement.style.width, ''); | 16 assert_equals(testElement.style.width, ''); |
| 17 }, "delete() removes the value from the property when set in element.style"); | 17 }, "delete() removes the value from the property when set in element.style"); |
| 18 | 18 |
| 19 test(function() { | 19 test(function() { |
| 20 testElement.styleMap.set('width', new CSSSimpleLength(100, 'px')); | 20 testElement.styleMap.set('width', new CSSUnitValue(100, 'px')); |
| 21 assert_equals(testElement.styleMap.get('width').cssText, '100px'); | 21 assert_equals(testElement.styleMap.get('width').cssText, '100px'); |
| 22 | 22 |
| 23 testElement.styleMap.delete('width'); | 23 testElement.styleMap.delete('width'); |
| 24 assert_equals(testElement.styleMap.get('width'), null); | 24 assert_equals(testElement.styleMap.get('width'), null); |
| 25 assert_equals(testElement.style.width, ''); | 25 assert_equals(testElement.style.width, ''); |
| 26 }, "delete() removes the value from the property when set in element.styleMap"); | 26 }, "delete() removes the value from the property when set in element.styleMap"); |
| 27 | 27 |
| 28 test(function() { | 28 test(function() { |
| 29 testElement.style.width = '90px'; | 29 testElement.style.width = '90px'; |
| 30 assert_equals(testElement.styleMap.get('width').cssText, '90px'); | 30 assert_equals(testElement.styleMap.get('width').cssText, '90px'); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 42 | 42 |
| 43 test(function() { | 43 test(function() { |
| 44 assert_throws(new TypeError(), function() { | 44 assert_throws(new TypeError(), function() { |
| 45 testElement.styleMap.delete('lemons'); | 45 testElement.styleMap.delete('lemons'); |
| 46 }); | 46 }); |
| 47 }, "Attempting to delete an invalid property throws"); | 47 }, "Attempting to delete an invalid property throws"); |
| 48 | 48 |
| 49 // TODO(meade): Test deleting a property containing multiple values once that ha
s been implemented. | 49 // TODO(meade): Test deleting a property containing multiple values once that ha
s been implemented. |
| 50 | 50 |
| 51 </script> | 51 </script> |
| OLD | NEW |