Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1521 from w3c/filereadersync
Add tests for FileReaderSync.
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
importScripts("/resources/testharness.js"); | ||
|
||
var blob, readerSync; | ||
setup(function() { | ||
readerSync = new FileReaderSync(); | ||
blob = new Blob(["test"]); | ||
}); | ||
|
||
test(function() { | ||
assert_true(readerSync instanceof FileReaderSync); | ||
}, "Interface"); | ||
|
||
test(function() { | ||
var text = readerSync.readAsText(blob); | ||
assert_equals(text, "test"); | ||
}, "readAsText"); | ||
|
||
test(function() { | ||
var data = readerSync.readAsDataURL(blob); | ||
assert_equals(data.indexOf("data:"), 0); | ||
}, "readAsDataURL"); | ||
|
||
test(function() { | ||
var data = readerSync.readAsArrayBuffer(blob); | ||
assert_true(data instanceof ArrayBuffer); | ||
}, "readAsArrayBuffer"); | ||
|
||
done(); |