Fix image provider unit test.

Change-Id: I3a219d7c6277b1cd8332b35f9403e4d99352af41
This commit is contained in:
Gergő Tisza 2014-02-19 22:56:55 +00:00 committed by Gergő Tisza
parent 258bdf7747
commit 3f326bb3bc

View file

@ -40,7 +40,7 @@
assert.ok( imageProvider ); assert.ok( imageProvider );
} ); } );
QUnit.asyncTest( 'Image load success test', 5, function ( assert ) { QUnit.test( 'Image load success test', 5, function ( assert ) {
var imageProvider = new mw.mmv.provider.Image(), var imageProvider = new mw.mmv.provider.Image(),
oldPerformance = imageProvider.performance, oldPerformance = imageProvider.performance,
fakeURL = 'fakeURL'; fakeURL = 'fakeURL';
@ -54,6 +54,7 @@
open: $.noop }; open: $.noop };
}; };
QUnit.stop();
imageProvider.performance.recordEntry = function ( type, total, url ) { imageProvider.performance.recordEntry = function ( type, total, url ) {
assert.strictEqual( type, 'image', 'Type matches' ); assert.strictEqual( type, 'image', 'Type matches' );
assert.ok( total < 10, 'Total is less than 10ms' ); assert.ok( total < 10, 'Total is less than 10ms' );
@ -66,11 +67,12 @@
return $.Deferred().resolve(); return $.Deferred().resolve();
}; };
QUnit.stop();
imageProvider.get( fakeURL ).then( function( image ) { imageProvider.get( fakeURL ).then( function( image ) {
assert.ok( image instanceof HTMLImageElement, assert.ok( image instanceof HTMLImageElement,
'success handler was called with the image element'); 'success handler was called with the image element');
assert.strictEqual( image.src, dataURI ); assert.strictEqual( image.src, dataURI );
QUnit.start();
} ); } );
} ); } );