browser_animation_current-time-scrubber-with-negative-delay.js (1644B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Test whether the most left position means negative current time. 7 8 add_task(async function () { 9 await addTab(URL_ROOT + "doc_multi_timings.html"); 10 await removeAnimatedElementsExcept([ 11 ".cssanimation-normal", 12 ".delay-negative", 13 ]); 14 const { animationInspector, panel, inspector } = 15 await openAnimationInspector(); 16 17 info("Checking scrubber controller existence"); 18 const controllerEl = panel.querySelector(".current-time-scrubber-area"); 19 ok(controllerEl, "scrubber controller should exist"); 20 21 info("Checking the current time of most left scrubber position"); 22 const timeScale = animationInspector.state.timeScale; 23 clickOnCurrentTimeScrubberController(animationInspector, panel, 0); 24 await waitUntilAnimationsPlayState(animationInspector, "paused"); 25 await waitUntilCurrentTimeChangedAt( 26 animationInspector, 27 -1 * timeScale.zeroPositionTime 28 ); 29 ok(true, "Current time is correct"); 30 31 info("Select negative current time animation"); 32 await selectNode(".cssanimation-normal", inspector); 33 await waitUntilCurrentTimeChangedAt( 34 animationInspector, 35 -1 * timeScale.zeroPositionTime 36 ); 37 ok(true, "Current time is correct"); 38 39 info("Back to 'body' and rewind the animation"); 40 await selectNode("body", inspector); 41 await waitUntil( 42 () => 43 panel.querySelectorAll(".animation-item").length === 44 animationInspector.state.animations.length 45 ); 46 clickOnRewindButton(animationInspector, panel); 47 await waitUntilCurrentTimeChangedAt(animationInspector, 0); 48 });