Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / css / variables / cssom-update.html
1 <!doctype html>
2 <head><script src="../../../resources/js-test.js"></script></head>
3
4 <div id="test-target" style="var-a: fail; var-b: fail;"></div>
5
6 <script>
7 description('This tests Javascript modification of CSS variables in inline styles.');
8
9 var div = document.querySelector('#test-target');
10
11 div.style.var.set('a', 'pass');
12 div.style.var.set('b', 'pass');
13 div.style.var.set('c', 'pass');
14
15 shouldBeEqualToString('div.style.cssText', 'var-a: pass; var-b: pass; var-c: pass;');
16 shouldBe('div.style.var.size', '3');
17 shouldBeEqualToString('div.style.var.get("a")', 'pass');
18 shouldBeEqualToString('div.style.var.get("b")', 'pass');
19 shouldBeEqualToString('div.style.var.get("c")', 'pass');
20
21 var forEachIterations = [];
22 div.style.var.forEach(function(value, name, map) {
23     forEachIterations.push([value, name, map.toString()]);
24 });
25
26 shouldBe('forEachIterations[0]', '["pass", "a", "[object CSSVariablesMap]"]');
27 shouldBe('forEachIterations[1]', '["pass", "b", "[object CSSVariablesMap]"]');
28 shouldBe('forEachIterations[2]', '["pass", "c", "[object CSSVariablesMap]"]');
29 shouldBe('forEachIterations.length', '3');
30 </script>