| <!DOCTYPE html> |
| <meta charset=utf-8> |
| <title>Canceling an animation: finish event</title> |
| <link rel="help" href="https://w3c.github.io/web-animations/#canceling-an-animation-section"> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <body> |
| <script> |
| async_test(t => { |
| var anim1 = document.body.animate([], 100000); |
| var anim2 = document.body.animate([], 100000); |
| |
| var success = false; |
| anim2.finished.catch(function() { |
| success = true; |
| }); |
| |
| anim1.finished.then(function() { |
| assert_true(success, 'anim2 finished promise should be rejected on cancelation'); |
| t.done(); |
| }); |
| |
| anim2.cancel(); |
| anim1.finish(); |
| }, 'Animation finished promise should be rejected when animation canceled'); |
| </script> |