Kaynağa Gözat

Tests/LibWeb: Initialize Blob with string and read it from arrayBuffer()

Kenneth Myhra 1 yıl önce
ebeveyn
işleme
d9fb116bcc

+ 1 - 0
Tests/LibWeb/Text/expected/FileAPI/Blob-intialized-with-strings-read-from-arrayBuffer.txt

@@ -0,0 +1 @@
+PASS

+ 13 - 0
Tests/LibWeb/Text/input/FileAPI/Blob-intialized-with-strings-read-from-arrayBuffer.html

@@ -0,0 +1,13 @@
+<script src="../include.js"></script>
+<script>
+    asyncTest(async (done) => {
+        const blob = new Blob(["This is some data to be read! 🦬"]);
+        const arrayBuffer = await blob.arrayBuffer();
+        const string = new TextDecoder().decode(new Uint8Array(arrayBuffer));
+        if (string === "This is some data to be read! 🦬")
+            println("PASS");
+        else
+            println("FAIL");
+        done();
+    });
+</script>