Tests/LibWeb: Add basic tests for setTimeout and setInterval

It is useful to have at least very basic tests for those APIs :)
This commit is contained in:
Aliaksandr Kalenik 2023-09-26 15:21:34 +02:00 committed by Andreas Kling
parent 4e8654e31b
commit fe3a824ad4
Notes: sideshowbarker 2024-07-16 21:30:46 +09:00
4 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,3 @@
setInterval completed count=0
setInterval completed count=1
setInterval completed count=2

View file

@ -0,0 +1 @@
setTimeout completed

View file

@ -0,0 +1,13 @@
<script src="include.js"></script>
<script>
asyncTest(done => {
let count = 0;
let intervalId = setInterval(() => {
println("setInterval completed count=" + count++);
if (count === 3) {
clearInterval(intervalId);
done();
}
}, 0);
});
</script>

View file

@ -0,0 +1,9 @@
<script src="include.js"></script>
<script>
asyncTest(done => {
setTimeout(() => {
println("setTimeout completed");
done();
}, 0);
});
</script>