Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Adding blobbuilder test. #52

Merged
merged 1 commit into from

2 participants

@mattwkelly

No description provided.

@darobin darobin merged commit 5e8b47e into coremob:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 10, 2012
  1. @mattwkelly

    Adding blobbuilder test.

    mattwkelly authored
This page is out of date. Refresh to see the latest.
Showing with 43 additions and 0 deletions.
  1. +4 −0 tests/blobbuilder/config.yml
  2. +39 −0 tests/blobbuilder/test.js
View
4 tests/blobbuilder/config.yml
@@ -0,0 +1,4 @@
+---
+ r: 1
+ spec: "http://dev.w3.org/2009/dap/file-system/file-writer.html#the-blobbuilder-interface"
+ title: "BlobBuilder"
View
39 tests/blobbuilder/test.js
@@ -0,0 +1,39 @@
+test("BlobBuilder", function() {
+ var BlobBuilder = H.API( window, "BlobBuilder", true );
+
+ assert( !!BlobBuilder, "BlobBuilder supported" );
+});
+
+test("BlobBuilder, Blob Slice", function() {
+ var BlobBuilder = H.API( window, "BlobBuilder", true ),
+ value = "Oh Hai!",
+ builder, blob, slice;
+
+ if ( !BlobBuilder ) {
+ assert( false, "BlobBuilder not supported, skipping tests" );
+ } else {
+ blob = (new BlobBuilder()).getBlob();
+ slice = H.API( blob, "slice", true );
+
+ assert( slice, "blob.slice supported (" + slice.name + ")" );
+ }
+});
+
+test("BlobBuilder In Practice", function() {
+ var BlobBuilder = H.API( window, "BlobBuilder", true ),
+ value = "Oh Hai!",
+ builder, blob;
+
+ if ( !BlobBuilder ) {
+ assert( false, "BlobBuilder not supported, skipping tests" );
+ } else {
+ builder = new BlobBuilder();
+ builder.append("Oh Hai!");
+
+ blob = builder.getBlob();
+
+ assert( H.isKindOf( blob, "Blob" ), "getBlob() supported" );
+ assert( blob.size === value.length, "blob.size is correct");
+ assert( "type" in blob, "blob.type supported" );
+ }
+});
Something went wrong with that request. Please try again.