persist.html (1199B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>Animation.persist</title> 4 <link rel="help" href="https://drafts.csswg.org/web-animations/#dom-animation-persist"> 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 async_test(t => { 14 const div = createDiv(t); 15 16 const animA = div.animate({ opacity: 1 }, { duration: 1, fill: 'forwards' }); 17 const animB = div.animate({ opacity: 1 }, { duration: 1, fill: 'forwards' }); 18 19 animA.onremove = t.step_func_done(() => { 20 assert_equals(animA.replaceState, 'removed'); 21 animA.persist(); 22 assert_equals(animA.replaceState, 'persisted'); 23 }); 24 }, 'Allows an animation to be persisted after being removed'); 25 26 promise_test(async t => { 27 const div = createDiv(t); 28 29 const animA = div.animate({ opacity: 1 }, { duration: 1, fill: 'forwards' }); 30 const animB = div.animate({ opacity: 1 }, { duration: 1, fill: 'forwards' }); 31 32 animA.persist(); 33 34 await animA.finished; 35 36 assert_equals(animA.replaceState, 'persisted'); 37 }, 'Allows an animation to be persisted before being removed'); 38 39 </script> 40 </body>