OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <meta charset=utf-8> | |
3 <title>Canceling an animation: cancel event</title> | |
4 <link rel="help" href="https://w3c.github.io/web-animations/#canceling-an-animat
ion-section"> | |
5 <script src="../resources/testharness.js"></script> | |
6 <script src="../resources/testharnessreport.js"></script> | |
7 <body> | |
8 <script> | |
9 var anim1 = document.body.animate([], 100000); | |
10 var anim2 = document.body.animate([], 100000); | |
11 | |
12 var cancelTest = async_test('Cancelling animation should fire a cancel event.'); | |
13 var fired = false; | |
14 | |
15 anim1.oncancel = function(event) { | |
16 cancelTest.step(function() { | |
17 assert_equals(event.target, anim1, 'Target of cancel event should be anim1.'
); | |
18 assert_equals(event.currentTime, null, 'currentTime of cancel event should b
e null.'); | |
19 assert_equals(event.timelineTime, document.timeline.currentTime, 'Event time
lineTime should be same as document.timeline.currentTime.'); | |
20 }); | |
21 fired = true; | |
22 }; | |
23 | |
24 anim2.onfinish = function() { | |
25 cancelTest.step(function() { | |
26 assert_true(fired, 'anim1.oncancel should be called.'); | |
27 }); | |
28 cancelTest.done(); | |
29 }; | |
30 | |
31 anim1.cancel(); | |
32 anim2.finish(); | |
33 </script> | |
OLD | NEW |