mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-05 00:56:39 +00:00
LibWeb: Add some async/animation test utilities
This commit is contained in:
parent
b2907f62a6
commit
e298e8af5a
Notes:
sideshowbarker
2024-07-16 23:55:09 +09:00
Author: https://github.com/mattco98
Commit: e298e8af5a
Pull-request: https://github.com/SerenityOS/serenity/pull/23774
13 changed files with 65 additions and 91 deletions
|
@ -2,7 +2,7 @@
|
|||
<div id="foo"></div>
|
||||
<script src="../../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
promiseTest(async () => {
|
||||
const foo = document.getElementById("foo");
|
||||
|
||||
let anim = foo.animate({}, {});
|
||||
|
@ -45,19 +45,17 @@
|
|||
let finishCount = 0;
|
||||
anim.onfinish = () => { finishCount++; }
|
||||
anim.finish();
|
||||
requestAnimationFrame(() => {
|
||||
if (finishCount === 1)
|
||||
println("finish() sends an onfinish event");
|
||||
})
|
||||
await animationFrame();
|
||||
if (finishCount === 1)
|
||||
println("finish() sends an onfinish event");
|
||||
|
||||
anim = foo.animate({}, { duration: 1000 });
|
||||
let finished = false;
|
||||
anim.finished.then(() => finished = true);
|
||||
anim.finish();
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
if (finished)
|
||||
println("finish() recreated the animation's finished promise");
|
||||
});
|
||||
await animationFrame();
|
||||
if (finished)
|
||||
println("finish() recreated the animation's finished promise");
|
||||
});
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue