mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-03 19:36:36 +00:00
e62f46dd80
Bug: T208951 Change-Id: Icf10ea6bbc09542e69c0cd583a4ee4f2f76a3f43
44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
( function () {
|
|
var HelpDialog = mw.libs.revisionSlider.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() )
|
|
);
|
|
} );
|
|
|
|
}() );
|