mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2025-01-07 11:24:16 +00:00
f7ae734b99
Added tests for DiffPage, HelpDialog and RevisionListView. Slightly refactored RevisionListView to improve testability. Bug:T137964 Change-Id: I07dc8059d5a90bdd6623fd7748d36ba212763e15
27 lines
1.1 KiB
JavaScript
27 lines
1.1 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(),
|
|
dialogue = new HelpDialog();
|
|
|
|
$( 'body' ).append( windowManager.$element );
|
|
windowManager.addWindows( [ helpDialog ] );
|
|
|
|
assert.equal( helpDialog.slides.length, 4 );
|
|
assert.equal( helpDialog.slidePointer, 0 );
|
|
assert.equal( getSlideTextHtml( helpDialog.slides[0] ), mw.message( 'revisionslider-help-dialog-slide1' ).parse() );
|
|
assert.equal( getSlideTextHtml( helpDialog.slides[1] ), mw.message( 'revisionslider-help-dialog-slide2' ).parse() );
|
|
assert.equal( getSlideTextHtml( helpDialog.slides[2] ), mw.message( 'revisionslider-help-dialog-slide3' ).parse() );
|
|
assert.equal( getSlideTextHtml( helpDialog.slides[3] ), mw.message( 'revisionslider-help-dialog-slide4' ).parse() );
|
|
} );
|
|
|
|
function getSlideTextHtml( slide ) {
|
|
return slide.$element.find( '.mw-help-dialog-text' ).html();
|
|
}
|
|
|
|
} )( mediaWiki );
|