pending.html (1592B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Animation.pending</title> 4 <link rel="help" href="https://drafts.csswg.org/web-animations/#dom-animation-pending"> 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 promise_test(t => { 14 const div = createDiv(t); 15 const animation = div.animate({}, 100 * MS_PER_SEC); 16 17 assert_true(animation.pending); 18 return animation.ready.then(() => { 19 assert_false(animation.pending); 20 }); 21 }, 'reports true -> false when initially played'); 22 23 promise_test(t => { 24 const div = createDiv(t); 25 const animation = div.animate({}, 100 * MS_PER_SEC); 26 animation.pause(); 27 28 assert_true(animation.pending); 29 return animation.ready.then(() => { 30 assert_false(animation.pending); 31 }); 32 }, 'reports true -> false when paused'); 33 34 promise_test(async t => { 35 const animation = 36 new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC), 37 null); 38 animation.play(); 39 assert_true(animation.pending); 40 await waitForAnimationFrames(2); 41 assert_true(animation.pending); 42 }, 'reports true -> true when played without a timeline'); 43 44 promise_test(async t => { 45 const animation = 46 new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC), 47 null); 48 animation.pause(); 49 assert_true(animation.pending); 50 await waitForAnimationFrames(2); 51 assert_true(animation.pending); 52 }, 'reports true -> true when paused without a timeline'); 53 54 </script> 55 </body>