1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-24 15:35:06 +00:00
serenity/Tests/LibWeb/Text/input/HTML/StructuredClone-serializable-objects.html
Kenneth Myhra 0f168d9ca2 Tests/LibWeb: Add test to prove we can {,de}serialize File
This test proves the ability of structuredClone() to serialize and
deserialize a File object.
2024-02-26 16:10:20 -07:00

20 lines
750 B
HTML

<script src="../include.js"></script>
<script>
asyncTest(async done => {
let blob = structuredClone(new Blob(["Hello, Blob!"], {type: "text/plain"}));
println(`instanceOf Blob: ${blob instanceof Blob}`);
println(`Blob.type: ${blob.type}`);
let text = await blob.text();
println(`Blob.text(): ${text}`);
let file = structuredClone(new File(["Hello, File!"], "hello.txt", {type: "text/plain"}));
println(`instanceOf File: ${file instanceof File}`);
println(`File.name: ${file.name}`);
println(`File.type: ${file.type}`);
text = await file.text();
println(`File.text(): ${text}`);
println(`File.size: ${file.size}`);
done();
});
</script>