mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-15 19:49:30 +00:00
8e7fe2434d
First I jumped on replacing both jscs and jshint with eslint but it might be premature decision. Although linting with eslint is possible (like in there is wikimedia config for eslint) it is still not clear should it But in case the change happens we will be ready. Apart from config stuff this changes few bits spotted by eslint: improves some indentation, removes weird spaces, completes some doc blocks, changes IIFE forms in tests. These changes do not seem controversial. Change-Id: I9f8bf0f5745da8e662685f4cd879ea4baa609c01
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
( function ( mw ) {
|
|
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.equal( helpDialog.slides.length, 4 );
|
|
assert.equal( helpDialog.slidePointer, 0 );
|
|
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 ] ),
|
|
addLinkTargets( mw.message( 'revisionslider-help-dialog-slide3' ).parse() )
|
|
);
|
|
assert.equal(
|
|
getSlideTextHtml( helpDialog.slides[ 3 ] ),
|
|
addLinkTargets( mw.message( 'revisionslider-help-dialog-slide4' ).parse() )
|
|
);
|
|
} );
|
|
|
|
}( mediaWiki ) );
|