mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-17 12:53:24 +00:00
109bbe6ac1
Everything is under mw.mmv now. (Also, I cut down on the number of direct global instance references a bit.) Change-Id: I88bb3b62b82ce54126dd069b0aab4412d9404719
30 lines
808 B
JavaScript
30 lines
808 B
JavaScript
( function ( mw ) {
|
|
QUnit.module( 'mmv.lightboximage', QUnit.newMwEnvironment() );
|
|
|
|
QUnit.asyncTest( 'Sanity test, object creation and image loading', 1, function ( assert ) {
|
|
var lightboxImage = new mw.mmv.LightboxImage( 'http://en.wikipedia.org/w/skins/vector/images/search-ltr.png' );
|
|
|
|
// Function to be called if loading is successful
|
|
function loadCallback() {
|
|
assert.ok( true, 'Image loaded !' );
|
|
QUnit.start();
|
|
}
|
|
|
|
lightboxImage.getImageElement()
|
|
.done( loadCallback );
|
|
} );
|
|
|
|
QUnit.asyncTest( 'Image failing', 1, function ( assert ) {
|
|
var lightboxImage = new mw.mmv.LightboxImage( 'fail' );
|
|
|
|
function errorCallback() {
|
|
assert.ok( true, 'Image failed !' );
|
|
QUnit.start();
|
|
}
|
|
|
|
lightboxImage.getImageElement()
|
|
.fail( errorCallback );
|
|
} );
|
|
|
|
}( mediaWiki, jQuery ) );
|