servo/tests/wpt/css-tests/css-animations-1_dev/xhtml1/animationstart-and-animationend-events.xht

127 lines
No EOL
6.1 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS3 Animations: To verify animationstart and animationend events are handled. </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<link rel="help" href="http://www.w3.org/TR/css3-animations/#animation-name-property" />
<link rel="help" href="http://www.w3.org/TR/css3-animations/#animation-duration-property" />
<link rel="help" href="http://www.w3.org/TR/css3-animations/#animation-events" />
<link rel="help" href="http://www.w3.org/TR/css3-animations/#timing-functions" />
<link rel="author" title="Nokia Inc." href="http://www.nokia.com/" />
<meta name="flags" content="animated" />
<meta name="assert" content="To verify if &quot;animationstart&quot; event occurs when animation starts and &quot;animationend&quot; occurs when the animation ends." />
<style type="text/css" media="screen">
/* <![CDATA[ */
@-webkit-keyframes sample {
from {
left: 150px;
}
to {
left: 0px;
}
}
@-moz-keyframes sample {
from {
left: 150px;
}
to {
left: 0px;
}
}
@keyframes sample {
from {
left: 150px;
}
to {
left: 0px;
}
}
.abc {
background-color: blue;
/*Added extra style information --- BEGIN modification*/
color: Yellow;
font-weight: bolder;
font-size: xx-large;
text-align: center;
vertical-align: middle;
/*Added extra style information --- END modification*/
width: 100px;
height: 100px;
padding: 0.2em 1em;
//margin: 6em;
position: relative;
-webkit-animation-name: sample;
//-webkit-animation-delay: 0.1s;
-webkit-animation-duration: 10s;
-webkit-animation-timing-function: linear;
-moz-animation-name: sample;
//-moz-animation-delay: 0.1s;
-moz-animation-duration: 10s;
-moz-animation-timing-function: linear;
animation-name: sample;
//animation-delay: 0.1s;
animation-duration: 10s;
animation-timing-function: linear;
}
/* ]]> */
</style>
<script type="text/javascript">
/* <![CDATA[ */
var box_var;
function init()
{
getvalues();
}
function getvalues()
{
box_var=document.getElementById('box');
box_var.addEventListener('webkitAnimationStart',start_f,true);
box_var.addEventListener('webkitAnimationEnd',end_f,true);
box_var.addEventListener('animationstart',start_f,true);
box_var.addEventListener('animationend',end_f,true);
<!--box_var.addEventListener('webkitAnimationEnd',start_f,true);-->
}
function start_f()
{
/*This line of code has been commented to avoid automated result evaluation.
*document.getElementById('result').innerHTML="TRUE";
*/
document.getElementById('box').innerHTML = "START";
}
function end_f()
{
/*This line of code has been commented to avoid automated result evaluation.
*document.getElementById('result1').innerHTML="TRUE";
*/
document.getElementById('box').innerHTML = "STOP";
}
/* ]]> */
</script>
</head>
<body onload="init()">
<p id="testdetails">
<p>
Assertion: To verify if "animationstart" event occurs when animation starts and "animationend" occurs when the animation ends.
</p>
<ul>
<li>PASS if blue box is rendered with text START as the animation begins and changes to STOP when animation is finished. </li>
<li>FAIL if text "FAIL" is displayed OR START is NOT rendered when animation begins OR STOP is NOT rendered when animation ends.</li>
</ul>
</p>
<div class="abc" id="box">
FAIL
</div>
<!-- below markup is removed to avoid inline display of results.
* <p><b>Animation Event Start Value:</b> <span id="result"></span></p>
* <p><b>Animation Event End Value:</b> <span id="result1"></span></p>
-->
</body>
</html>