| Index: third_party/WebKit/LayoutTests/typedcssom/inlineStylePropertyMap_setGet.html
|
| diff --git a/third_party/WebKit/LayoutTests/typedcssom/inlineStylePropertyMap_setGet.html b/third_party/WebKit/LayoutTests/typedcssom/inlineStylePropertyMap_setGet.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..262d243c0991388485f99839b3fed1ccd9862a55
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/typedcssom/inlineStylePropertyMap_setGet.html
|
| @@ -0,0 +1,64 @@
|
| +<!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('10px', testElement.styleMap.get('width').cssString);
|
| +}, "Setting and getting round trips");
|
| +
|
| +test(function() {
|
| + testElement.style.width = '20px';
|
| + assert_equals('20px', testElement.styleMap.get('width').cssString);
|
| +}, "Changes to element.style are reflected in the element.styleMap");
|
| +
|
| +test(function() {
|
| + testElement.styleMap.set('width', new SimpleLength(30, 'px'));
|
| + assert_equals('30px', testElement.style.width);
|
| +}, "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('2px', testElement.styleMap.get('width').cssString);
|
| +}, "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(null, testElement.styleMap.get('height'));
|
| +}, "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() {
|
| + testElement.styleMap.set('width', null);
|
| + // Force a style recalc.
|
| + getComputedStyle(testElement).width;
|
| +}, "Setting null to a property does not crash");
|
| +
|
| +
|
| +</script>
|
|
|