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

Unified Diff: third_party/WebKit/LayoutTests/typedcssom/computedstyle/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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/typedcssom/inlinestyle/numbers.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/typedcssom/computedstyle/numbers.html
diff --git a/third_party/WebKit/LayoutTests/typedcssom/computedstyle/numbers.html b/third_party/WebKit/LayoutTests/typedcssom/computedstyle/numbers.html
new file mode 100644
index 0000000000000000000000000000000000000000..e78969693309d474ba6094b440bf77b241d735c1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/typedcssom/computedstyle/numbers.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+
+<div id="testElement">text</div>
+
+<script>
+
+EPSILON = 0.000001;
+
+var properties = {
+ 'animation-iteration-count': 1,
+ 'column-count': 2,
+ 'opacity': 0.3,
+ 'orphans': 4,
+ 'widows': 5,
+};
+
+var computedMap = getComputedStyleMap(testElement);
+
+test(function() {
+ for (var property in properties) {
+ var value = properties[property];
+ testElement.style[property] = "" + value;
+ var result = computedMap.get(property);
+ assert_true(result instanceof CSSNumberValue);
+ assert_approx_equals(result.value, value, EPSILON);
+ }
+}, "Single valued CSSNumberValues can be retrieved from Computed StyleMap");
+
+test(function() {
+ testElement.style.animationIterationCount = "6.2, 9.8, 1";
+
+ var result = computedMap.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_approx_equals(result[0].value, 6.2, EPSILON);
+ assert_approx_equals(result[1].value, 9.8, EPSILON);
+ assert_approx_equals(result[2].value, 1, EPSILON);
+}, "Can retrieve list of CSSNumberValues from list-valued property");
+
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/typedcssom/inlinestyle/numbers.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698