Bug 1465077 - Part 2: Add a test which checks whether the scrubber never be located at negative position. r?pbro
MozReview-Commit-ID: 1xeOzaJlYwH
--- a/devtools/client/inspector/animation/test/browser_animation_pause-resume-button_end-time.js
+++ b/devtools/client/inspector/animation/test/browser_animation_pause-resume-button_end-time.js
@@ -21,27 +21,35 @@ add_task(async function() {
["running", "finished", "finished"]);
await clickOnCurrentTimeScrubberController(animationInspector, panel, 0);
info("Check animations state after resuming without infinite animation");
info("Remove infinite animation");
await setClassAttribute(animationInspector, ".animated", "ball still");
info("Make the current time of animation to be over its end time");
await clickOnCurrentTimeScrubberController(animationInspector, panel, 1);
+ await clickOnPlaybackRateSelector(animationInspector, panel, 10);
info("Resume animations");
await clickOnPauseResumeButton(animationInspector, panel);
assertPlayState(animationInspector.state.animations, ["running", "running"]);
assertCurrentTimeLessThanDuration(animationInspector.state.animations);
+ assertScrubberPosition(panel);
});
function assertPlayState(animations, expectedState) {
animations.forEach((animation, index) => {
is(animation.state.playState, expectedState[index],
`The playState of animation [${ index }] should be ${ expectedState[index] }`);
});
}
function assertCurrentTimeLessThanDuration(animations) {
animations.forEach((animation, index) => {
ok(animation.state.currentTime < animation.state.duration,
- "The current time of animation[${ index }] should be less than its duration");
+ `The current time of animation[${ index }] should be less than its duration`);
});
}
+
+function assertScrubberPosition(panel) {
+ const scrubberEl = panel.querySelector(".current-time-scrubber");
+ const translateX = parseFloat(scrubberEl.style.transform.match(/-?\d+(\.\d+)?/)[0]);
+ ok(translateX >= 0, "The translateX of scrubber position should be zero or more");
+}