OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>Animation.oncancel</title> | 3 <title>Animation.oncancel</title> |
4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animation-oncan
cel"> | 4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animation-oncan
cel"> |
5 <script src="/resources/testharness.js"></script> | 5 <script src="/resources/testharness.js"></script> |
6 <script src="/resources/testharnessreport.js"></script> | 6 <script src="/resources/testharnessreport.js"></script> |
7 <script src="../../testcommon.js"></script> | 7 <script src="../../testcommon.js"></script> |
8 <link rel="stylesheet" href="/resources/testharness.css"> | |
9 <body> | 8 <body> |
10 <div id="log"></div> | 9 <div id="log"></div> |
11 <script> | 10 <script> |
12 "use strict"; | 11 "use strict"; |
13 | 12 |
14 async_test(function(t) { | 13 async_test(function(t) { |
15 var div = createDiv(t); | 14 var div = createDiv(t); |
16 var animation = div.animate({}, 100 * MS_PER_SEC); | 15 var animation = div.animate({}, 100 * MS_PER_SEC); |
17 var finishedTimelineTime; | 16 var finishedTimelineTime; |
18 animation.finished.then().catch(function() { | 17 animation.finished.then().catch(function() { |
19 finishedTimelineTime = animation.timeline.currentTime; | 18 finishedTimelineTime = animation.timeline.currentTime; |
20 }); | 19 }); |
21 | 20 |
22 animation.oncancel = t.step_func_done(function(event) { | 21 animation.oncancel = t.step_func_done(function(event) { |
23 assert_equals(event.currentTime, null, | 22 assert_equals(event.currentTime, null, |
24 'event.currentTime should be null'); | 23 'event.currentTime should be null'); |
25 assert_equals(event.timelineTime, finishedTimelineTime, | 24 assert_equals(event.timelineTime, finishedTimelineTime, |
26 'event.timelineTime should equal to the animation timeline ' + | 25 'event.timelineTime should equal to the animation timeline ' + |
27 'when finished promise is rejected'); | 26 'when finished promise is rejected'); |
28 }); | 27 }); |
29 | 28 |
30 animation.cancel(); | 29 animation.cancel(); |
31 }, 'oncancel event is fired when animation.cancel() is called.'); | 30 }, 'oncancel event is fired when animation.cancel() is called.'); |
32 | 31 |
33 </script> | 32 </script> |
34 </body> | 33 </body> |
OLD | NEW |