mediawiki-extensions-Revisi.../tests/RevisionSlider.SliderView.test.js
addshore 44904e8687 Avoid changing the URL during SliderView test
This was super annoying as if you went to refresh
the test page to run the tests again it would take
you to some broken diff page instead...

Change-Id: I43ca8edd005aa3ef72b74a5d812cbe39bccaf332
2016-05-13 11:23:00 +00:00

32 lines
991 B
JavaScript

( function ( mw ) {
var SliderView = mw.libs.revisionSlider.SliderView,
Slider = mw.libs.revisionSlider.Slider,
Revision = mw.libs.revisionSlider.Revision,
RevisionList = mw.libs.revisionSlider.RevisionList,
startHistoryState, startHref;
QUnit.module( 'ext.RevisionSlider.SliderView' );
QUnit.testStart( function () {
startHistoryState = history.state;
startHref = window.location.href;
} );
QUnit.testDone( function () {
history.replaceState( startHistoryState, 'QUnit', startHref );
} );
QUnit.test( 'render', function ( assert ) {
var $container = $( '<div/>' ),
view = new SliderView( new Slider( new RevisionList( [
new Revision( { size: 5, comment: 'Comment1', user: 'User1' } ),
new Revision( { size: 21, comment: 'Comment2', user: 'User2' } ),
new Revision( { size: 13, comment: 'Comment3', user: 'User3' } )
] ) ) );
view.render( $container );
assert.ok( $container.find( '.revision-slider' ).length > 0 );
} );
} )( mediaWiki );