mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-22 09:18:55 +00:00
Tests/LibWeb: Add TransformStream start callback test
This test proves the ability of TransformStream to execute caller supplied code in the start callback, and have access to TransformStreamDefaultController.
This commit is contained in:
parent
74fdf59941
commit
5c6125c92b
Notes:
sideshowbarker
2024-07-16 23:17:55 +09:00
Author: https://github.com/kennethmyhra
Commit: 5c6125c92b
Pull-request: https://github.com/SerenityOS/serenity/pull/19998
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/shannonbooth
2 changed files with 23 additions and 0 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
In start
|
||||||
|
Done: false
|
||||||
|
Hello, world!
|
|
@ -0,0 +1,20 @@
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
const {readable} = new TransformStream({
|
||||||
|
start(controller) {
|
||||||
|
println("In start");
|
||||||
|
controller.enqueue("Hello, world!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
const reader = readable.getReader();
|
||||||
|
reader.read().then(function processText({done, value}) {
|
||||||
|
println(`Done: ${done}`);
|
||||||
|
if (done)
|
||||||
|
return;
|
||||||
|
|
||||||
|
println(value);
|
||||||
|
reader.read().then(processText);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue