Bladeren bron

Tests/LibWeb: Add test to prove we can {,de}serialize Blob

This test proves the ability of structuredClone() to serialize and
deserialize a Blob object.
Kenneth Myhra 1 jaar geleden
bovenliggende
commit
44e5c62545

+ 3 - 0
Tests/LibWeb/Text/expected/HTML/StructuredClone-serializable-objects.txt

@@ -0,0 +1,3 @@
+instanceOf Blob: true
+Blob.type: text/plain
+Blob.text(): Hello, Blob!

+ 12 - 0
Tests/LibWeb/Text/input/HTML/StructuredClone-serializable-objects.html

@@ -0,0 +1,12 @@
+<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}`);
+
+        done();
+    });
+</script>