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

Unified Diff: LayoutTests/fast/css/variables/cssom-update.html

Issue 21006006: Add forEach() to CSSVariablesMap (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase and review changes Created 7 years, 3 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: LayoutTests/fast/css/variables/cssom-update.html
diff --git a/LayoutTests/fast/css/variables/cssom-update.html b/LayoutTests/fast/css/variables/cssom-update.html
index eb899b08547563dc76d586bea52b570e744bb5a1..4a0d8c0f1f89ec7869469db327f6d18f1c30f86a 100644
--- a/LayoutTests/fast/css/variables/cssom-update.html
+++ b/LayoutTests/fast/css/variables/cssom-update.html
@@ -1,21 +1,31 @@
<!doctype html>
+<head><script src="../../js/resources/js-test-pre.js"></script></head>
-<style>
- div {
- background-color: var(color);
- border-style: var(border);
- }
-</style>
-
-<div id="outer" style="var-color: darkred; var-border: dashed">
- This div should be green with a solid border.
- <div>This div should also be green with a solid border.</div>
-</div>
+<div id="test-target" style="var-a: fail; var-b: fail;"></div>
<script>
-var outer = document.querySelector("#outer");
+description('This tests Javascript modification of CSS variables in inline styles.');
+
+var div = document.querySelector('#test-target');
+
+div.style.var.set('a', 'pass');
+div.style.var.set('b', 'pass');
+div.style.var.set('c', 'pass');
+
+shouldBeEqualToString('div.style.cssText', 'var-a: pass; var-b: pass; var-c: pass;');
+shouldBe('div.style.var.size', '3');
+shouldBeEqualToString('div.style.var.get("a")', 'pass');
+shouldBeEqualToString('div.style.var.get("b")', 'pass');
+shouldBeEqualToString('div.style.var.get("c")', 'pass');
-outer.style.var.set("color", "green");
-outer.style.var.set("border", "solid");
+var forEachIterations = [];
+div.style.var.forEach(function(value, name, map) {
+ forEachIterations.push([value, name, map.toString()]);
+});
+shouldBe('forEachIterations[0]', '["pass", "a", "[object CSSVariablesMap]"]');
+shouldBe('forEachIterations[1]', '["pass", "b", "[object CSSVariablesMap]"]');
+shouldBe('forEachIterations[2]', '["pass", "c", "[object CSSVariablesMap]"]');
+shouldBe('forEachIterations.length', '3');
</script>
+<script src="../../js/resources/js-test-post.js"></script>
« no previous file with comments | « LayoutTests/fast/css/variables/cssom-read-expected.txt ('k') | LayoutTests/fast/css/variables/cssom-update-expected.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698