mediawiki-extensions-Multim.../tests/qunit/lightboxinterface.test.js
Aaron Arcos 2baf271def Smoke tests for LightboxInterface class.
Change-Id: I5ecefc75c85e14104e951fc71556f2d06e612f71
2013-12-04 17:16:00 -08:00

30 lines
1.1 KiB
JavaScript

( function ( mw, $ ) {
QUnit.module( 'ext.multimediaViewer.lightboxInterface', QUnit.newMwEnvironment() );
QUnit.test( 'Sanity test, object creation and ui construction', 9, function ( assert ) {
var lightbox = new window.LightboxInterface();
function checkIfUIAreasAttachedToDocument( inDocument ) {
var msg = inDocument === 1 ? ' ' : ' not ';
assert.strictEqual( $( '.mlb-wrapper' ).length, inDocument, 'Wrapper area' + msg + 'attached.' );
assert.strictEqual( $( '.mlb-main' ).length, inDocument, 'Main area' + msg + 'attached.' );
assert.strictEqual( $( '.mlb-overlay' ).length, inDocument, 'Overlay area' + msg + 'attached.' );
}
// UI areas not attached to the document yet.
checkIfUIAreasAttachedToDocument(0);
// Attach lightbox to document
lightbox.attach();
// UI areas should now be attached to the document.
checkIfUIAreasAttachedToDocument(1);
// Unattach lightbox from document
lightbox.unattach();
// UI areas not attached to the document anymore.
checkIfUIAreasAttachedToDocument(0);
} );
}( mediaWiki, jQuery ) );