mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
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:
parent
4e8654e31b
commit
fe3a824ad4
3
Tests/LibWeb/Text/expected/setInterval.txt
Normal file
3
Tests/LibWeb/Text/expected/setInterval.txt
Normal file
|
@ -0,0 +1,3 @@
|
|||
setInterval completed count=0
|
||||
setInterval completed count=1
|
||||
setInterval completed count=2
|
1
Tests/LibWeb/Text/expected/setTimeout.txt
Normal file
1
Tests/LibWeb/Text/expected/setTimeout.txt
Normal file
|
@ -0,0 +1 @@
|
|||
setTimeout completed
|
13
Tests/LibWeb/Text/input/setInterval.html
Normal file
13
Tests/LibWeb/Text/input/setInterval.html
Normal 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>
|
9
Tests/LibWeb/Text/input/setTimeout.html
Normal file
9
Tests/LibWeb/Text/input/setTimeout.html
Normal file
|
@ -0,0 +1,9 @@
|
|||
<script src="include.js"></script>
|
||||
<script>
|
||||
asyncTest(done => {
|
||||
setTimeout(() => {
|
||||
println("setTimeout completed");
|
||||
done();
|
||||
}, 0);
|
||||
});
|
||||
</script>
|
Loading…
Reference in a new issue