gecko-dev/layout/style/test/test_transitions_dynamic_changes.html

61 lines
2.0 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=525530
-->
<head>
<title>Test for Bug 525530</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<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.MozTransitionProperty = "all";
p.style.MozTransitionDuration = "4s";
p.style.MozTransitionDelay = "-2s";
p.style.MozTransitionTimingFunction = "linear";
is(cs.textIndent, "100px", "initial value");
p.style.textIndent = "0";
is(cs.textIndent, "50px", "transition is halfway");
p.style.MozTransitionDuration = "0s";
is(cs.textIndent, "50px", "changing duration doesn't change transitioning");
p.style.MozTransitionDelay = "0s";
is(cs.textIndent, "50px", "changing delay doesn't change transitioning");
p.style.MozTransitionProperty = "text-indent";
is(cs.textIndent, "50px",
"irrelevant change to transition property doesn't change transitioning");
p.style.MozTransitionProperty = "font";
is(cs.textIndent, "0px",
"relevant change to transition property does change transitioning");
/** Test for Bug 522643 */
p.style.MozTransitionDuration = "4s";
p.style.MozTransitionDelay = "-2s";
p.style.MozTransitionProperty = "text-indent";
p.style.textIndent = "100px";
is(cs.textIndent, "50px", "transition is halfway");
p.style.MozTransitionDuration = "0s";
p.style.MozTransitionDelay = "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>