Index: third_party/WebKit/LayoutTests/typedcssom/inlinestyle/numbers.html |
diff --git a/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/numbers.html b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/numbers.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..2c9b4faf272a3bdc6b6b92e2d4cf7e0b09a7f9ad |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/numbers.html |
@@ -0,0 +1,68 @@ |
+<!DOCTYPE html> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+ |
+<div id="testElement">text</div> |
+ |
+<script> |
+ |
+var properties = [ |
+ 'animation-iteration-count', |
+ 'line-height', |
+ 'orphans', |
+ 'column-count', |
+ 'widows', |
+ 'z-index' |
+]; |
+ |
+test(function() { |
+ for (var i = 0; i < properties.length; i++) { |
+ var value = 10 * (i + 1); |
+ testElement.styleMap.set(properties[i], new CSSNumberValue(value)); |
+ |
+ var result = testElement.styleMap.get(properties[i]); |
+ assert_true(result instanceof CSSNumberValue); |
+ assert_equals(result.value, value); |
+ |
+ assert_equals(testElement.style[properties[i]], "" + value); |
+ } |
+}, "CSSNumberValue round trips when passed in as CSSNumberValue."); |
+ |
+test(function() { |
+ for (var i = 0; i < properties.length; i++) { |
+ var value = 10 * (i + 1); |
+ testElement.style[properties[i]] = "" + value; |
+ var result = testElement.styleMap.get(properties[i]); |
+ assert_true(result instanceof CSSNumberValue); |
+ assert_equals(result.value, value); |
+ } |
+}, "CSSNumberValue round trips when passed as a string to the old OM."); |
+ |
+test(function() { |
+ var numberValues = [ new CSSNumberValue(1), new CSSNumberValue(5.5)]; |
+ testElement.styleMap.set('animation-iteration-count', numberValues); |
+ |
+ var result = testElement.styleMap.getAll('animation-iteration-count'); |
+ assert_equals(result.length, 2); |
+ assert_true(result[0] instanceof CSSNumberValue); |
+ assert_true(result[1] instanceof CSSNumberValue); |
+ assert_equals(result[0].value, 1); |
+ assert_equals(result[1].value, 5.5); |
+ |
+ assert_equals(testElement.style.animationIterationCount, "1, 5.5"); |
+}, "CSSNumberValues in a list round trip when passed in as a list of CSSNumberValues"); |
+ |
+test(function() { |
+ testElement.style.animationIterationCount = "6.2, 9.8, 1"; |
+ |
+ var result = testElement.styleMap.getAll('animation-iteration-count'); |
+ assert_equals(result.length, 3); |
+ assert_true(result[0] instanceof CSSNumberValue); |
+ assert_true(result[1] instanceof CSSNumberValue); |
+ assert_true(result[2] instanceof CSSNumberValue); |
+ assert_equals(result[0].value, 6.2); |
+ assert_equals(result[1].value, 9.8); |
+ assert_equals(result[2].value, 1); |
+}, "CSSNumberValues in a list round trip when passed in as a string to the old OM"); |
+ |
+</script> |