OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset="utf-8"> |
| 3 <title>HTML Test: marquee-events</title> |
| 4 <link rel="author" title="Intel" href="http://www.intel.com/"> |
| 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/multipage/obsolete
.html#the-marquee-element"> |
| 6 <script src="../../../../../../resources/testharness.js"></script> |
| 7 <script src="../../../../../../resources/testharnessreport.js"></script> |
| 8 <div id="log"></div> |
| 9 <marquee id="test1" loop="2" width="1" behavior="alternate"> </marquee> |
| 10 <marquee id="test2" loop="2" width="1"> </marquee> |
| 11 <script> |
| 12 var mq; |
| 13 var t_start = async_test("marquee_events_start"); |
| 14 var t_finish = async_test("marquee_events_finish"); |
| 15 var t_bounce = async_test("marquee_events_bounce"); |
| 16 var t_bounce2 = async_test("marquee_events_bounce2"); |
| 17 var timeStamp = []; |
| 18 var bounced = false; |
| 19 |
| 20 setup(function() { |
| 21 mq = document.getElementById("test1"); |
| 22 mq2 = document.getElementById("test2"); |
| 23 }); |
| 24 |
| 25 mq.addEventListener("start", function(evt) { |
| 26 t_start.step(function() { |
| 27 timeStamp.push(evt.timeStamp); |
| 28 assert_true(evt.isTrusted, "The onstart event is created by UA, it must be
trusted."); |
| 29 assert_equals(timeStamp.length, 1, "The onstart event should be fired firs
tly."); |
| 30 assert_false(evt.bubbles, "The bubbles property of onstart event should be
false."); |
| 31 assert_false(evt.cancelable, "The cancelable property of onstart event sho
uld be false."); |
| 32 assert_true(evt instanceof Event, "The onstart event must be the instance
of Event interface."); |
| 33 }); |
| 34 t_start.done(); |
| 35 }); |
| 36 |
| 37 mq.addEventListener("finish", function(evt) { |
| 38 t_finish.step(function() { |
| 39 timeStamp.push(evt.timeStamp); |
| 40 assert_true(evt.isTrusted, "The onfinish event is created by UA, it must b
e trusted."); |
| 41 assert_equals(timeStamp.length, 3, "The onfinish event should be fired las
tly."); |
| 42 assert_false(evt.bubbles, "The bubbles property of onfinish event should b
e false."); |
| 43 assert_false(evt.cancelable, "The cancelable property of onfinish event sh
ould be false."); |
| 44 assert_true(evt instanceof Event, "The onfinish event must be the instance
of Event interface."); |
| 45 }); |
| 46 t_finish.done(); |
| 47 }); |
| 48 |
| 49 mq.addEventListener("bounce", function(evt) { |
| 50 t_bounce.step(function() { |
| 51 timeStamp.push(evt.timeStamp); |
| 52 assert_true(evt.isTrusted, "The onbounce event is created by UA, it must b
e trusted."); |
| 53 assert_equals(timeStamp.length, 2, "The onbounce event should be fired sec
ondly."); |
| 54 assert_false(evt.bubbles, "The bubbles property of onbounce event should b
e false."); |
| 55 assert_false(evt.cancelable, "The cancelable property of onbounce event sh
ould be false."); |
| 56 assert_true(evt instanceof Event, "The onbounce event must be the instance
of Event interface."); |
| 57 }); |
| 58 t_bounce.done(); |
| 59 }); |
| 60 |
| 61 mq2.addEventListener("bounce", function(evt) { |
| 62 bounced = true; |
| 63 }); |
| 64 |
| 65 mq2.addEventListener("finish", function(evt) { |
| 66 t_bounce2.step(function () { |
| 67 assert_false(bounced, "The onbounce event should not be fired."); |
| 68 }); |
| 69 t_bounce2.done(); |
| 70 }); |
| 71 </script> |
OLD | NEW |