Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: third_party/WebKit/LayoutTests/typedcssom/inlinestyle/numbers.html

Issue 2274463002: [Typed OM] Add CSSValue -> CSSNumberValue conversion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add test for computed style Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..31b1308156ad13673131b25f0ae28a750ecd0e22
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/typedcssom/inlinestyle/numbers.html
@@ -0,0 +1,42 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+
+<div id="testElement">text</div>
+
+<script>
+
+var gettingProperties = [
+ 'animation-iteration-count',
+ 'column-count',
+ 'line-height',
+ 'opacity',
+ 'orphans',
+ 'widows',
+ 'z-index'
+];
+
+test(function() {
+ for (var i = 0; i < gettingProperties.length; i++) {
+ var value = 10 * (i + 1);
+ testElement.style[gettingProperties[i]] = "" + value;
+ var result = testElement.styleMap.get(gettingProperties[i]);
+ assert_true(result instanceof CSSNumberValue, "result from " + gettingProperties[i]);
+ assert_equals(result.value, value);
+ }
+}, "Single valued CSSNumberValues can be retrieved from Inline StyleMap");
+
+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);
+}, "Can retrieve list of CSSNumberValues from list-valued property");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698