| Index: third_party/WebKit/LayoutTests/typedcssom/inlinestyle/inlineStylePropertyMap_setGet.html
|
| diff --git a/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/inlineStylePropertyMap_setGet.html b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/inlineStylePropertyMap_setGet.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f5c6cb327e3002e0f7fe56614bd45024fee99931
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/inlineStylePropertyMap_setGet.html
|
| @@ -0,0 +1,73 @@
|
| +<!DOCTYPE html>
|
| +<script src="../../resources/testharness.js"></script>
|
| +<script src="../../resources/testharnessreport.js"></script>
|
| +
|
| +<div id="testElement"></div>
|
| +
|
| +<script>
|
| +
|
| +test(function() {
|
| + testElement.styleMap.set('width', new SimpleLength(10, 'px'));
|
| + assert_equals(testElement.styleMap.get('width').cssString, '10px');
|
| +}, "Setting and getting round trips");
|
| +
|
| +test(function() {
|
| + testElement.styleMap.set('WIDTH', new SimpleLength(40, 'px'));
|
| + assert_equals(testElement.styleMap.get('WiDtH').cssString, '40px');
|
| + testElement.styleMap.set('wIdTh', new SimpleLength(50, 'px'));
|
| + assert_equals(testElement.styleMap.get('width').cssString, '50px');
|
| +}, "Setting and getting is not case sensitive");
|
| +
|
| +test(function() {
|
| + testElement.style.width = '20px';
|
| + assert_equals(testElement.styleMap.get('width').cssString, '20px');
|
| +}, "Changes to element.style are reflected in the element.styleMap");
|
| +
|
| +test(function() {
|
| + testElement.styleMap.set('width', new SimpleLength(30, 'px'));
|
| + assert_equals(testElement.style.width, '30px');
|
| +}, "Changes to element.styleMap are reflected in element.style");
|
| +
|
| +test(function() {
|
| + assert_throws(new TypeError(), function() {
|
| + testElement.styleMap.set('width', new NumberValue(4));
|
| + });
|
| +}, "Attempting to set an invalid type for a property throws");
|
| +
|
| +test(function() {
|
| + testElement.styleMap.set('width', new SimpleLength(2, 'px'));
|
| + assert_throws(new TypeError(), function() {
|
| + testElement.styleMap.set('width', new NumberValue(4));
|
| + });
|
| + assert_equals(testElement.styleMap.get('width').cssString, '2px');
|
| +}, "Attempting to set an invalid type for a property does not change the value");
|
| +
|
| +test(function() {
|
| + assert_throws(new TypeError(), function() {
|
| + testElement.styleMap.set('lemons', new NumberValue(4));
|
| + });
|
| + assert_throws(new TypeError(), function() {
|
| + testElement.styleMap.set('lemons', null);
|
| + });
|
| +}, "Attempting to set an invalid property throws");
|
| +
|
| +test(function() {
|
| + assert_equals(testElement.styleMap.get('height'), null);
|
| +}, "Getting a property that isn't set returns null");
|
| +
|
| +test(function() {
|
| + assert_throws(new TypeError(), function() {
|
| + testElement.styleMap.get('lemons');
|
| + });
|
| +}, "Getting a property that doesn't exist throws");
|
| +
|
| +test(function() {
|
| + assert_throws(new TypeError(), function() {
|
| + testElement.styleMap.set('width', null);
|
| + });
|
| + // Force a style recalc.
|
| + getComputedStyle(testElement).width;
|
| +}, "Setting null to a property does not crash");
|
| +
|
| +
|
| +</script>
|
|
|