mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/MultimediaViewer
synced 2024-11-12 09:27:36 +00:00
53da285b07
* 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
30 lines
800 B
JavaScript
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 ) );
|