
META-INF.resources.bower_components.blueimp-canvas-to-blob.test.test.min.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jwebmp-blueimp-fileupload Show documentation
Show all versions of jwebmp-blueimp-fileupload Show documentation
File Upload widget with multiple file selection, drag and drop support, progress bar, validation and preview images, audio and video for jQuery.
Supports cross-domain, chunked and resumable file uploads.
Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.
The newest version!
(function(){var e=chai.expect;var d=function(f,i,g,h){setTimeout(function(){i(dataURLtoBlob(f.toDataURL(g,h)))})};var a="R0lGODdhUAA8AIABAAAAAP///ywAAAAAUAA8AAACS4SPqcvtD6OctNqLs968+w+G4kiW5omm6sq27gvH8kzX9o3n+s73/g8MCofEovGITCqXzKbzCY1Kp9Sq9YrNarfcrvcLDovH5PKsAAA7";var c="data:image/gif;base64,"+a;var b=dataURLtoBlob(c);describe("canvas.toBlob",function(){it("Converts a canvas element to a blob and passes it to the callback function",function(f){window.loadImage(b,function(g){d(g,function(h){e(h).to.be.a.instanceOf(Blob);f()})},{canvas:true})});it("Converts a canvas element to a PNG blob",function(f){window.loadImage(b,function(g){d(g,function(h){e(h.type).to.equal("image/png");f()},"image/png")},{canvas:true})});it("Converts a canvas element to a JPG blob",function(f){window.loadImage(b,function(g){d(g,function(h){e(h.type).to.equal("image/jpeg");f()},"image/jpeg")},{canvas:true})});it("Keeps the aspect ratio of the canvas image",function(f){window.loadImage(b,function(g){d(g,function(h){window.loadImage(h,function(i){e(i.width).to.equal(g.width);e(i.height).to.equal(g.height);f()})})},{canvas:true})});it("Keeps the image data of the canvas image",function(f){window.loadImage(b,function(g){d(g,function(h){window.loadImage(h,function(k){var j=g.getContext("2d").getImageData(0,0,g.width,g.height);var i=k.getContext("2d").getImageData(0,0,k.width,k.height);e(j.width).to.equal(i.width);e(j.height).to.equal(i.height);f()},{canvas:true})})},{canvas:true})})})})();