play.html (1222B)
1 <!DOCTYPE html> 2 <meta charset=utf-8> 3 <title>Animation.play</title> 4 <link rel="help" href="https://drafts.csswg.org/web-animations/#dom-animation-play"> 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({ transform: ['none', 'translate(10px)']}, 16 { duration: 100 * MS_PER_SEC, 17 iterations: Infinity }); 18 return animation.ready.then(() => { 19 // Seek to a time outside the active range so that play() will have to 20 // snap back to the start 21 animation.currentTime = -5 * MS_PER_SEC; 22 animation.playbackRate = -1; 23 24 assert_throws_dom('InvalidStateError', 25 () => { animation.play(); }, 26 'Expected InvalidStateError exception on calling play() ' + 27 'with a negative playbackRate and infinite-duration ' + 28 'animation'); 29 }); 30 }, 'play() throws when seeking an infinite-duration animation played in ' + 31 'reverse'); 32 33 </script> 34 </body>