trigger-scope-support.js (689B)
1 // Used in trigger-scope-* tests to check whether an animation was triggered or 2 // not. 3 async function assert_playstate_and_current_time(target_id, animation, play_state) { 4 // The animation might start on a different user-agent thread and need 5 // a moment to get currentTime up to date. 6 await waitForCompositorReady(); 7 8 assert_equals(animation.playState, play_state, 9 `animation on ${target_id} is ${play_state}.`); 10 11 if (play_state === "running") { 12 assert_greater_than(animation.currentTime, 0, 13 `animation on ${target_id} has currentTime > 0.`); 14 } else { 15 assert_equals(animation.currentTime, 0, 16 `animation on ${target_id} has currentTime == 0.`); 17 } 18 }