4 <title>CSS Variables - Transitions - Variable value specified before transition; 'all' keyword used
</title>
6 <meta rel=
"author" title=
"Kevin Babbitt">
7 <meta rel=
"author" title=
"Greg Whitworth">
8 <link rel=
"author" title=
"Microsoft Corporation" href=
"http://microsoft.com" />
9 <link rel=
"help" href=
"http://www.w3.org/TR/css-variables-1/#syntax">
11 <script src=
"/resources/testharness.js"></script>
12 <script src=
"/resources/testharnessreport.js"></script>
17 transition-property: all;
18 transition-duration:
1s;
33 <div id=
"target">This text should transition from blue to green over a period of
1 second.
</div>
35 <script type=
"text/javascript">
38 // Force an initial layout pass
39 document
.documentElement
.offsetHeight
;
42 assert_equals(window
.getComputedStyle(document
.getElementById("target")).getPropertyValue("--value").trim(), "blue", "--value is blue before transition runs");
43 }, "Verify CSS variable value before transition");
46 // Different browsers generate interpolated colors differently, so check multiple valid forms.
47 assert_in_array(window
.getComputedStyle(document
.getElementById("target")).getPropertyValue("color").trim(),
48 ["rgb(0, 0, 255)", "rgba(0, 0, 255, 1)"],
49 "color is blue before transition runs");
50 }, "Verify substituted color value before transition");
52 var afterAnimationVariableTest
= async_test("Verify CSS variable value after transition");
53 document
.getElementById("target").addEventListener("transitionend", afterAnimationVariableTest
.step_func_done(function() {
54 assert_equals(window
.getComputedStyle(document
.getElementById("target")).getPropertyValue("--value").trim(), "green", "--value is green after transition runs")
57 var afterAnimationColorTest
= async_test("Verify substituted color value after transition");
58 document
.getElementById("target").addEventListener("transitionend", afterAnimationColorTest
.step_func_done(function() {
59 assert_in_array(window
.getComputedStyle(document
.getElementById("target")).getPropertyValue("color").trim(),
60 ["rgb(0, 128, 0)", "rgba(0, 128, 0, 1)"],
61 "color is green after transition runs")
65 document
.getElementById("target").className
= "changed";
67 // Force another layout pass
68 document
.documentElement
.offsetHeight
;