mediawiki-extensions-Multim.../tests/qunit/mmv/mmv.lightboximage.test.js
Gergő Tisza 109bbe6ac1 Namespacing MMV properly
Everything is under mw.mmv now.
(Also, I cut down on the number of direct global instance references a bit.)

Change-Id: I88bb3b62b82ce54126dd069b0aab4412d9404719
2014-02-25 13:16:22 +01:00

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 ) );