' ).appendTo( $qf ),
dialog = new mw.mmv.ui.TipsyDialog( $anchor );
assert.ok( !$( '.mw-mmv-tipsy-dialog' ).length, 'dialog is not shown' );
dialog.open();
assert.ok( $( '.mw-mmv-tipsy-dialog' ).length, 'dialog is shown' );
dialog.close();
assert.ok( !$( '.mw-mmv-tipsy-dialog' ).length, 'dialog is not shown' );
} );
QUnit.test( 'setContent', 3, function ( assert ) {
var $qf = $( '#qunit-fixture' ),
$anchor = $( '
' ).appendTo( $qf ),
titleText = 'This is a title',
bodyText = 'This is the
body',
dialog = new mw.mmv.ui.TipsyDialog( $anchor );
dialog.setContent( titleText, bodyText );
dialog.open();
assert.ok( $( '.mw-mmv-tipsy-dialog' ).text().match( titleText ), 'Title is included' );
assert.ok( $( '.mw-mmv-tipsy-dialog' ).html().match( bodyText ), 'Body is included' );
assert.ok( $( '.mw-mmv-tipsy-dialog' ).find( '.typsyDialogTest-123' ).length, 'Body is HTML' );
} );
QUnit.test( 'Close on click', 4, function ( assert ) {
var $qf = $( '#qunit-fixture' ),
$anchor = $( '
' ).appendTo( $qf ),
dialog = new mw.mmv.ui.TipsyDialog( $anchor );
dialog.open();
assert.ok( $( '.mw-mmv-tipsy-dialog' ).length, 'dialog is shown initially' );
dialog.getPopup().click();
assert.ok( $( '.mw-mmv-tipsy-dialog' ).length, 'dialog is not hidden when clicked' );
dialog.getPopup().find( '.mw-mmv-tipsy-dialog-disable' ).click();
assert.ok( !$( '.mw-mmv-tipsy-dialog' ).length, 'dialog is hidden when close icon is clicked' );
dialog.open();
$qf.click();
assert.ok( !$( '.mw-mmv-tipsy-dialog' ).length, 'dialog is hidden when clicked outside' );
} );
}( mediaWiki, jQuery ) );