2017-06-29 08:14:27 +00:00
|
|
|
( function ( mw, $ ) {
|
2016-06-29 10:43:46 +00:00
|
|
|
var HelpDialog = mw.libs.revisionSlider.HelpDialog;
|
|
|
|
|
|
|
|
QUnit.module( 'ext.RevisionSlider.HelpDialog' );
|
|
|
|
|
|
|
|
QUnit.test( 'Initialize HelpDialog', function ( assert ) {
|
|
|
|
var helpDialog = new HelpDialog(),
|
2016-07-01 10:24:30 +00:00
|
|
|
windowManager = new OO.ui.WindowManager();
|
|
|
|
|
|
|
|
function getSlideTextHtml( slide ) {
|
2016-07-01 10:13:53 +00:00
|
|
|
return slide.$element.find( '.mw-revslider-help-dialog-text' ).html();
|
2016-07-01 10:24:30 +00:00
|
|
|
}
|
2016-06-29 10:43:46 +00:00
|
|
|
|
2016-07-20 09:59:03 +00:00
|
|
|
function addLinkTargets( parsedMessage ) {
|
|
|
|
var $container = $( '<div>' ).html( parsedMessage );
|
|
|
|
$container.find( 'a' ).attr( 'target', '_blank' );
|
|
|
|
return $container.html();
|
|
|
|
}
|
|
|
|
|
2016-06-29 10:43:46 +00:00
|
|
|
$( 'body' ).append( windowManager.$element );
|
|
|
|
windowManager.addWindows( [ helpDialog ] );
|
|
|
|
|
|
|
|
assert.equal( helpDialog.slides.length, 4 );
|
|
|
|
assert.equal( helpDialog.slidePointer, 0 );
|
2016-07-20 09:59:03 +00:00
|
|
|
assert.equal(
|
|
|
|
getSlideTextHtml( helpDialog.slides[ 0 ] ),
|
|
|
|
addLinkTargets( mw.message( 'revisionslider-help-dialog-slide1' ).parse() )
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
getSlideTextHtml( helpDialog.slides[ 1 ] ),
|
|
|
|
addLinkTargets( mw.message( 'revisionslider-help-dialog-slide2' ).parse() )
|
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
getSlideTextHtml( helpDialog.slides[ 2 ] ),
|
2017-07-04 10:29:59 +00:00
|
|
|
addLinkTargets( mw.message( 'revisionslider-help-dialog-slide3a' ).parse() )
|
2016-07-20 09:59:03 +00:00
|
|
|
);
|
|
|
|
assert.equal(
|
|
|
|
getSlideTextHtml( helpDialog.slides[ 3 ] ),
|
|
|
|
addLinkTargets( mw.message( 'revisionslider-help-dialog-slide4' ).parse() )
|
|
|
|
);
|
2016-06-29 10:43:46 +00:00
|
|
|
} );
|
|
|
|
|
2017-06-29 08:14:27 +00:00
|
|
|
}( mediaWiki, jQuery ) );
|