tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

oncancel.html (1028B)


      1 <!DOCTYPE html>
      2 <meta charset=utf-8>
      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>
      8 <body>
      9 <div id="log"></div>
     10 <script>
     11 'use strict';
     12 
     13 async_test(t => {
     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;
     19  });
     20 
     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');
     27  });
     28 
     29  animation.cancel();
     30 }, 'oncancel event is fired when animation.cancel() is called.');
     31 
     32 </script>
     33 </body>