ladybird/Tests/LibWeb/Text/input/Streams/WritableStream-write.html
Timothy Flynn f3f7f77dbc LibWeb: Wait for the correct condition in Stream tests
We were signaling that the test is complete too early in some Stream
tests.
2024-10-03 07:07:28 -04:00

31 lines
733 B
HTML

<script src="../include.js"></script>
<script>
asyncTest(done => {
const stream = new WritableStream({
write(chunk) {
return new Promise(resolve => {
println(chunk);
resolve();
});
},
close() {
done();
}
});
function sendMessage(message) {
const writer = stream.getWriter();
for (const chunk of message) {
writer.ready.then(() => writer.write(chunk));
}
writer.ready.then(() => {
writer.close();
});
}
sendMessage("Well-hello-friends!");
});
</script>