OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>Animation.ready</title> | 3 <title>Animation.ready</title> |
4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animation-ready
"> | 4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animation-ready
"> |
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 <body> | 8 <body> |
9 <div id="log"></div> | 9 <div id="log"></div> |
10 <script> | 10 <script> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 var retPromise = animation.ready.then(function() { | 64 var retPromise = animation.ready.then(function() { |
65 assert_unreached('ready promise was fulfilled'); | 65 assert_unreached('ready promise was fulfilled'); |
66 }).catch(function(err) { | 66 }).catch(function(err) { |
67 assert_equals(err.name, 'AbortError', | 67 assert_equals(err.name, 'AbortError', |
68 'ready promise is rejected with AbortError'); | 68 'ready promise is rejected with AbortError'); |
69 }); | 69 }); |
70 | 70 |
71 animation.cancel(); | 71 animation.cancel(); |
72 | 72 |
73 return retPromise; | 73 return retPromise; |
74 }, 'ready promise is rejected when a pause-pending animation is cancelled by' | 74 }, 'ready promise is rejected when a play-pending animation is cancelled by' |
75 + ' calling cancel()'); | 75 + ' calling cancel()'); |
76 | 76 |
77 promise_test(function(t) { | 77 promise_test(function(t) { |
78 var div = createDiv(t); | 78 var div = createDiv(t); |
79 var animation = div.animate({}, 100 * MS_PER_SEC); | 79 var animation = div.animate({}, 100 * MS_PER_SEC); |
80 return animation.ready.then(function() { | 80 return animation.ready.then(function() { |
81 animation.pause(); | 81 animation.pause(); |
82 // Set up listeners on pause-pending ready promise | 82 // Set up listeners on pause-pending ready promise |
83 var retPromise = animation.ready.then(function() { | 83 var retPromise = animation.ready.then(function() { |
84 assert_unreached('ready promise was fulfilled'); | 84 assert_unreached('ready promise was fulfilled'); |
85 }).catch(function(err) { | 85 }).catch(function(err) { |
86 assert_equals(err.name, 'AbortError', | 86 assert_equals(err.name, 'AbortError', |
87 'ready promise is rejected with AbortError'); | 87 'ready promise is rejected with AbortError'); |
88 }); | 88 }); |
89 animation.cancel(); | 89 animation.cancel(); |
90 return retPromise; | 90 return retPromise; |
91 }); | 91 }); |
92 }, 'ready promise is rejected when a pause-pending animation is cancelled by' | 92 }, 'ready promise is rejected when a pause-pending animation is cancelled by' |
93 + ' calling cancel()'); | 93 + ' calling cancel()'); |
94 | 94 |
95 </script> | 95 </script> |
96 </body> | 96 </body> |
OLD | NEW |