mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-22 09:18:55 +00:00
LibWeb: Use InternalAnimationTimeline in existing tests
This commit is contained in:
parent
f0119a818b
commit
328ad9a2f0
Notes:
sideshowbarker
2024-07-17 07:19:27 +09:00
Author: https://github.com/mattco98
Commit: 328ad9a2f0
Pull-request: https://github.com/SerenityOS/serenity/pull/23774
4 changed files with 13 additions and 14 deletions
|
@ -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"}`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue