LibWeb: Use InternalAnimationTimeline in existing tests

This commit is contained in:
Matthew Olsson 2024-03-29 18:40:37 +00:00 committed by Andreas Kling
commit 328ad9a2f0
Notes: sideshowbarker 2024-07-17 07:19:27 +09:00
4 changed files with 13 additions and 14 deletions

View file

@ -2,7 +2,7 @@
<div id="foo"></div>
<script src="../../include.js"></script>
<script>
promiseTest(async () => {
test(() => {
const foo = document.getElementById("foo");
let animation = new Animation(null, null);
@ -11,14 +11,13 @@
animation = new Animation(new KeyframeEffect(foo, []));
println(`Animation that hasn't been played has null currentTime: ${animation.currentTime === null}`);
animation = foo.animate({ color: "red" }, { duration: 1000 });
const timeline = internals.createInternalAnimationTimeline();
animation = foo.animate({ color: "red" }, { duration: 1000, timeline });
println(`Played animation has a currentTime of 0: ${animation.currentTime === 0}`);
await timeout(100);
// FIXME: Figure out how to consistently test timings
// if (animation.currentTime > 95 && animation.currentTime < 105)
// println("Animation time after 100ms is correct");
timeline.setTime(100);
if (animation.currentTime === 100)
println("Animation time after 100ms is correct");
animation = foo.animate({ opacity: [0, 1] }, { duration: 1000 });
println(`New animation has not started animating: ${getComputedStyle(foo).opacity === "0"}`);