3 <title>Animation.oncancel</title>
4 <link rel="help" href="https://drafts.csswg.org/web-animations/#dom-animation-oncancel">
5 <script src="/resources/testharness.js"></script>
6 <script src="/resources/testharnessreport.js"></script>
7 <script src="../../testcommon.js"></script>
14 const div = createDiv(t);
15 const animation = div.animate({}, 100 * MS_PER_SEC);
16 let finishedTimelineTime;
17 animation.finished.then().catch(() => {
18 finishedTimelineTime = animation.timeline.currentTime;
21 animation.oncancel = t.step_func_done(event => {
22 assert_equals(event.currentTime, null,
23 'event.currentTime should be null');
24 assert_times_equal(event.timelineTime, finishedTimelineTime,
25 'event.timelineTime should equal to the animation timeline ' +
26 'when finished promise is rejected');
30 }, 'oncancel event is fired when animation.cancel() is called.');