gecko/layout/style/test/test_transitions_dynamic_changes.html

60 lines
1.9 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=525530
-->
<head>
<title>Test for Bug 525530</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=525530">Mozilla Bug 525530</a>
<p id="display" style="text-indent: 100px"></p>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 525530 **/
var p = document.getElementById("display");
var cs = getComputedStyle(p, "");
p.style.transitionProperty = "all";
p.style.transitionDuration = "4s";
p.style.transitionDelay = "-2s";
p.style.transitionTimingFunction = "linear";
is(cs.textIndent, "100px", "initial value");
p.style.textIndent = "0";
is(cs.textIndent, "50px", "transition is halfway");
p.style.transitionDuration = "0s";
is(cs.textIndent, "50px", "changing duration doesn't change transitioning");
p.style.transitionDelay = "0s";
is(cs.textIndent, "50px", "changing delay doesn't change transitioning");
p.style.transitionProperty = "text-indent";
is(cs.textIndent, "50px",
"irrelevant change to transition property doesn't change transitioning");
p.style.transitionProperty = "font";
is(cs.textIndent, "0px",
"relevant change to transition property does change transitioning");
/** Test for Bug 522643 */
p.style.transitionDuration = "4s";
p.style.transitionDelay = "-2s";
p.style.transitionProperty = "text-indent";
p.style.textIndent = "100px";
is(cs.textIndent, "50px", "transition is halfway");
p.style.transitionDuration = "0s";
p.style.transitionDelay = "0s";
is(cs.textIndent, "50px",
"changing duration and delay doesn't change transitioning");
p.style.textIndent = "0px";
is(cs.textIndent, "0px",
"changing property after changing duration and delay stops transition");
</script>
</pre>
</body>
</html>