mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-11 06:56:09 +00:00
1407e0a90d
It's never used in another context but together with the ….Slider module as well as the ….init module. The ….init module continues to require the ….Slider module, so all dependencies are still met. Motivated by the confusion about the two types of require() introduced in Idf1cc79. Bug: T233279 Change-Id: I4b4ef69f3074d57f884763c092a515ce976daaef
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
var HelpDialog = require( 'ext.RevisionSlider.Slider' ).HelpDialog;
|
|
|
|
QUnit.module( 'ext.RevisionSlider.HelpDialog' );
|
|
|
|
QUnit.test( 'Initialize HelpDialog', function ( assert ) {
|
|
var helpDialog = new HelpDialog(),
|
|
windowManager = new OO.ui.WindowManager();
|
|
|
|
function getSlideTextHtml( slide ) {
|
|
return slide.$element.find( '.mw-revslider-help-dialog-text' ).html();
|
|
}
|
|
|
|
function addLinkTargets( parsedMessage ) {
|
|
var $container = $( '<div>' ).html( parsedMessage );
|
|
$container.find( 'a' ).attr( 'target', '_blank' );
|
|
return $container.html();
|
|
}
|
|
|
|
$( 'body' ).append( windowManager.$element );
|
|
windowManager.addWindows( [ helpDialog ] );
|
|
|
|
assert.strictEqual( helpDialog.slides.length, 4 );
|
|
assert.strictEqual( helpDialog.slidePointer, 0 );
|
|
assert.strictEqual(
|
|
getSlideTextHtml( helpDialog.slides[ 0 ] ),
|
|
addLinkTargets( mw.message( 'revisionslider-help-dialog-slide1' ).parse() )
|
|
);
|
|
assert.strictEqual(
|
|
getSlideTextHtml( helpDialog.slides[ 1 ] ),
|
|
addLinkTargets( mw.message( 'revisionslider-help-dialog-slide2' ).parse() )
|
|
);
|
|
assert.strictEqual(
|
|
getSlideTextHtml( helpDialog.slides[ 2 ] ),
|
|
addLinkTargets( mw.message( 'revisionslider-help-dialog-slide3a' ).parse() )
|
|
);
|
|
assert.strictEqual(
|
|
getSlideTextHtml( helpDialog.slides[ 3 ] ),
|
|
addLinkTargets( mw.message( 'revisionslider-help-dialog-slide4' ).parse() )
|
|
);
|
|
} );
|