-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
Blob.prototype. type
more spec compliant
- Loading branch information
1 parent
9bf4d9b
commit e838f8b
Showing
6 changed files
with
135 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { test, expect } from "bun:test"; | ||
|
||
test("Blob.slice", () => { | ||
const blob = new Blob(["Bun", "Foo"]); | ||
const b1 = blob.slice(0, 3, "Text/HTML"); | ||
expect(b1 instanceof Blob).toBeTruthy(); | ||
expect(b1.size).toBe(3); | ||
expect(b1.type).toBe("text/html"); | ||
const b2 = blob.slice(-1, 3); | ||
expect(b2.size).toBe(0); | ||
const b3 = blob.slice(100, 3); | ||
expect(b3.size).toBe(0); | ||
const b4 = blob.slice(0, 10); | ||
expect(b4.size).toBe(blob.size); | ||
}); | ||
|
||
test("new Blob", () => { | ||
var blob = new Blob(["Bun", "Foo"], { type: "text/foo" }); | ||
expect(blob.size).toBe(6); | ||
expect(blob.type).toBe("text/foo"); | ||
|
||
blob = new Blob(["Bun", "Foo"], { type: "\u1234" }); | ||
expect(blob.size).toBe(6); | ||
expect(blob.type).toBe(""); | ||
}); |