OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>Animation.playState</title> |
| 4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animation-plays
tate"> |
| 5 <script src="../../../../resources/testharness.js"></script> |
| 6 <script src="../../../../resources/testharnessreport.js"></script> |
| 7 <script src="../testcommon.js"></script> |
| 8 <link rel="stylesheet" href="../../../../resources/testharness.css"> |
| 9 <body> |
| 10 <div id="log"></div> |
| 11 <script> |
| 12 'use strict'; |
| 13 |
| 14 promise_test(function(t) { |
| 15 var div = createDiv(t); |
| 16 var animation = div.animate({}, 100 * MS_PER_SEC); |
| 17 |
| 18 assert_equals(animation.playState, 'pending'); |
| 19 return animation.ready.then(function() { |
| 20 assert_equals(animation.playState, 'running'); |
| 21 }); |
| 22 }, 'Animation.playState reports \'pending\'->\'running\' when initially ' + |
| 23 'played'); |
| 24 |
| 25 promise_test(function(t) { |
| 26 var div = createDiv(t); |
| 27 var animation = div.animate({}, 100 * MS_PER_SEC); |
| 28 animation.pause(); |
| 29 |
| 30 assert_equals(animation.playState, 'pending'); |
| 31 return animation.ready.then(function() { |
| 32 assert_equals(animation.playState, 'paused'); |
| 33 }); |
| 34 }, 'Animation.playState reports \'pending\'->\'paused\' when pausing'); |
| 35 |
| 36 test(function(t) { |
| 37 var div = createDiv(t); |
| 38 var animation = div.animate({}, 100 * MS_PER_SEC); |
| 39 animation.cancel(); |
| 40 assert_equals(animation.playState, 'idle'); |
| 41 }, 'Animation.playState is \'idle\' when canceled.'); |
| 42 |
| 43 test(function(t) { |
| 44 var div = createDiv(t); |
| 45 var animation = div.animate({}, 100 * MS_PER_SEC); |
| 46 animation.cancel(); |
| 47 animation.currentTime = 50 * MS_PER_SEC; |
| 48 assert_equals(animation.playState, 'paused', |
| 49 'After seeking an idle animation, it is effectively paused'); |
| 50 }, 'Animation.playState is \'paused\' after cancelling an animation, ' + |
| 51 'seeking it makes it paused'); |
| 52 |
| 53 </script> |
| 54 </body> |
OLD | NEW |