mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-04 23:30:20 +00:00
LibWeb: Add a test for Animation.play()
This commit is contained in:
parent
7472536ecb
commit
074f5429a6
Notes:
sideshowbarker
2024-07-17 06:54:15 +09:00
Author: https://github.com/mattco98
Commit: 074f5429a6
Pull-request: https://github.com/SerenityOS/serenity/pull/23756
2 changed files with 39 additions and 0 deletions
|
@ -0,0 +1,4 @@
|
||||||
|
Cannot rewind an animation with an infinite effect end
|
||||||
|
play() leaves animation's startTime unresolved: true
|
||||||
|
play() does not recreate the animation's ready promise
|
||||||
|
play() does not synchronously resolve the ready promise
|
|
@ -0,0 +1,35 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<div id="foo"></div>
|
||||||
|
<script src="../../include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
const foo = document.getElementById("foo");
|
||||||
|
|
||||||
|
let anim = foo.animate({}, { duration: Infinity });
|
||||||
|
anim.cancel();
|
||||||
|
anim.playbackRate = -1;
|
||||||
|
|
||||||
|
try {
|
||||||
|
anim.play();
|
||||||
|
} catch {
|
||||||
|
println("Cannot rewind an animation with an infinite effect end")
|
||||||
|
}
|
||||||
|
|
||||||
|
anim = foo.animate({}, {});
|
||||||
|
anim.play();
|
||||||
|
println(`play() leaves animation's startTime unresolved: ${anim.startTime === null}`);
|
||||||
|
|
||||||
|
anim = foo.animate({}, {});
|
||||||
|
let oldPromise = anim.ready;
|
||||||
|
anim.play();
|
||||||
|
if (Object.is(oldPromise, anim.ready))
|
||||||
|
println("play() does not recreate the animation's ready promise");
|
||||||
|
|
||||||
|
anim = foo.animate({}, {});
|
||||||
|
anim.play();
|
||||||
|
anim.ready.catch(() => {
|
||||||
|
println("play() does not synchronously resolve the ready promise");
|
||||||
|
});
|
||||||
|
anim.cancel();
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue