browser_animation_infinity-duration_current-time-scrubber.js (1552B)
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 scrubber was working for even the animation of infinity duration. 7 8 add_task(async function () { 9 await addTab(URL_ROOT + "doc_infinity_duration.html"); 10 await removeAnimatedElementsExcept([".infinity-delay-iteration-start"]); 11 const { animationInspector, panel } = await openAnimationInspector(); 12 13 info("Set initial state"); 14 clickOnCurrentTimeScrubberController(animationInspector, panel, 0); 15 await waitUntilAnimationsPlayState(animationInspector, "paused"); 16 const initialCurrentTime = 17 animationInspector.state.animations[0].state.currentTime; 18 19 info("Check whether the animation currentTime was increased"); 20 clickOnCurrentTimeScrubberController(animationInspector, panel, 1); 21 await waitUntil( 22 () => 23 initialCurrentTime < 24 animationInspector.state.animations[0].state.currentTime 25 ); 26 ok(true, "currentTime should be increased"); 27 28 info("Check whether the progress bar was moved"); 29 const areaEl = panel.querySelector(".keyframes-progress-bar-area"); 30 const barEl = areaEl.querySelector(".keyframes-progress-bar"); 31 const controllerBounds = areaEl.getBoundingClientRect(); 32 const barBounds = barEl.getBoundingClientRect(); 33 const barX = barBounds.x + barBounds.width / 2 - controllerBounds.x; 34 const expectedBarX = controllerBounds.width * 0.5; 35 Assert.less( 36 Math.abs(barX - expectedBarX), 37 1, 38 "Progress bar should indicate at progress of 0.5" 39 ); 40 });