blob: 0d20c5102f17148ff3e5d1115e9a3fcfc7770bb3 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8">
<title>HTML Test: marquee-events</title>
<link rel="author" title="Intel" href="http://www.intel.com/">
<link rel="help" href="https://html.spec.whatwg.org/multipage/multipage/obsolete.html#the-marquee-element">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<marquee id="test1" loop="2" width="1" behavior="alternate">&nbsp;</marquee>
<marquee id="test2" loop="2" width="1">&nbsp;</marquee>
<script>
var mq;
var t_start = async_test("marquee_events_start");
var t_finish = async_test("marquee_events_finish");
var t_bounce = async_test("marquee_events_bounce");
var t_bounce2 = async_test("marquee_events_bounce2");
var timeStamp = [];
var bounced = false;
setup(function() {
mq = document.getElementById("test1");
mq2 = document.getElementById("test2");
});
mq.addEventListener("start", function(evt) {
t_start.step(function() {
timeStamp.push(evt.timeStamp);
assert_true(evt.isTrusted, "The onstart event is created by UA, it must be trusted.");
assert_equals(timeStamp.length, 1, "The onstart event should be fired firstly.");
assert_false(evt.bubbles, "The bubbles property of onstart event should be false.");
assert_false(evt.cancelable, "The cancelable property of onstart event should be false.");
assert_true(evt instanceof Event, "The onstart event must be the instance of Event interface.");
});
t_start.done();
});
mq.addEventListener("finish", function(evt) {
t_finish.step(function() {
timeStamp.push(evt.timeStamp);
assert_true(evt.isTrusted, "The onfinish event is created by UA, it must be trusted.");
assert_equals(timeStamp.length, 3, "The onfinish event should be fired lastly.");
assert_false(evt.bubbles, "The bubbles property of onfinish event should be false.");
assert_false(evt.cancelable, "The cancelable property of onfinish event should be false.");
assert_true(evt instanceof Event, "The onfinish event must be the instance of Event interface.");
});
t_finish.done();
});
mq.addEventListener("bounce", function(evt) {
t_bounce.step(function() {
timeStamp.push(evt.timeStamp);
assert_true(evt.isTrusted, "The onbounce event is created by UA, it must be trusted.");
assert_equals(timeStamp.length, 2, "The onbounce event should be fired secondly.");
assert_false(evt.bubbles, "The bubbles property of onbounce event should be false.");
assert_false(evt.cancelable, "The cancelable property of onbounce event should be false.");
assert_true(evt instanceof Event, "The onbounce event must be the instance of Event interface.");
});
t_bounce.done();
});
mq2.addEventListener("bounce", function(evt) {
bounced = true;
});
mq2.addEventListener("finish", function(evt) {
t_bounce2.step(function () {
assert_false(bounced, "The onbounce event should not be fired.");
});
t_bounce2.done();
});
</script>