mediawiki-extensions-Multim.../tests/qunit/mmv/mmv.lightboximage.test.js
Gergő Tisza 53da285b07 Merge MultiLightbox into MultimediaViewer
* merges parent classes into child classes
* moves some files and tests to have a consistent directory structure

Change-Id: I360cc0805d8a561f5105fb063747457f67e1fccd
Mingle: https://wikimedia.mingle.thoughtworks.com/projects/multimedia/cards/177
2014-02-25 02:00:13 +00:00

30 lines
800 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.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.LightboxImage( 'fail' );
function errorCallback() {
assert.ok( true, 'Image failed !' );
QUnit.start();
}
lightboxImage.getImageElement()
.fail( errorCallback );
} );
}( mediaWiki, jQuery ) );