Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #40 from facebook/filesaver

Adding filesaver test.
NOTE: feature testing
  • Loading branch information...
commit f920d7bf2856dca40e6a673fe4c5755c4d4510d0 2 parents af00ec0 + 609eb8a
@darobin darobin authored
Showing with 47 additions and 0 deletions.
  1. +4 −0 tests/filesaver/config.yml
  2. +43 −0 tests/filesaver/test.js
View
4 tests/filesaver/config.yml
@@ -0,0 +1,4 @@
+---
+ r: 1
+ spec: "http://www.w3.org/TR/file-writer-api/#idl-def-FileSaver"
+ title: "FileSaver"
View
43 tests/filesaver/test.js
@@ -0,0 +1,43 @@
+test("FileSaver", function() {
+ var FileSaver = H.API( window, "FileSaver", true );
+
+ assert( !!FileSaver, "FileSaver supported" );
+});
+
+test("FileSaver Events", function() {
+ var FileSaver = H.API( window, "FileSaver", true ),
+ saver;
+
+ if ( !FileSaver ) {
+ assert( false, "FileSaver not supported, skipping tests" );
+ } else {
+ saver = new FileSaver();
+
+ [
+ "onabort",
+ "onerror",
+ "onwrite",
+ "onwriteend",
+ "onwritestart",
+ "onprogress"
+ ].forEach(function( event ) {
+ assert( event in saver, event + " supported" );
+ });
+ }
+});
+
+test("FileSaver API", function() {
+ var FileSaver = H.API( window, "FileSaver", true );
+
+ if ( !FileSaver ) {
+ assert( false, "FileSaver not supported, skipping tests" );
+ } else {
+ [
+ "write",
+ "seek",
+ "truncate"
+ ].forEach(function( method ) {
+ assert( method in FileSaver.prototype, method + " supported" );
+ });
+ }
+});
Please sign in to comment.
Something went wrong with that request. Please try again.