mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:47:34 +00:00
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.
This commit is contained in:
parent
0b64a71603
commit
0f168d9ca2
2 changed files with 13 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
instanceOf Blob: true
|
instanceOf Blob: true
|
||||||
Blob.type: text/plain
|
Blob.type: text/plain
|
||||||
Blob.text(): Hello, Blob!
|
Blob.text(): Hello, Blob!
|
||||||
|
instanceOf File: true
|
||||||
|
File.name: hello.txt
|
||||||
|
File.type: text/plain
|
||||||
|
File.text(): Hello, File!
|
||||||
|
File.size: 12
|
|
@ -7,6 +7,14 @@
|
||||||
let text = await blob.text();
|
let text = await blob.text();
|
||||||
println(`Blob.text(): ${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();
|
done();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue