mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-12 15:35:11 +00:00
1fa153aeab
The new mw eslint config comes with node 12 and the change will be quite big due to the lock file. I wanted to keep the diff of actual code changes seperate. - Applied all code style recommendations - Removed one test that's not giving any value - Changed regex .match to .test for performance and convinience Change-Id: I578be8c6460c7a4d1220354c028a9bfd9bb86d13
41 lines
959 B
JavaScript
41 lines
959 B
JavaScript
var SliderModule = require( 'ext.RevisionSlider.Slider' ),
|
|
DiffPage = SliderModule.DiffPage,
|
|
SliderView = SliderModule.SliderView,
|
|
Slider = SliderModule.Slider,
|
|
RevisionList = SliderModule.RevisionList,
|
|
Revision = SliderModule.Revision;
|
|
|
|
QUnit.module( 'ext.RevisionSlider.DiffPage' );
|
|
|
|
QUnit.test( 'Push state', function ( assert ) {
|
|
var diffPage = new DiffPage(),
|
|
sliderView = new SliderView( new Slider( new RevisionList( [
|
|
new Revision( { revid: 1, comment: '' } ),
|
|
new Revision( { revid: 3, comment: '' } ),
|
|
new Revision( { revid: 37, comment: '' } )
|
|
] ) )
|
|
);
|
|
|
|
mw.config.set( {
|
|
wgDiffOldId: 1,
|
|
wgDiffNewId: 37
|
|
} );
|
|
sliderView.render( $( '<div>' ) );
|
|
|
|
var histLength = history.length;
|
|
|
|
diffPage.pushState( 3, 37, sliderView );
|
|
|
|
assert.strictEqual( history.length, histLength + 1 );
|
|
assert.propEqual(
|
|
history.state,
|
|
{
|
|
diff: 3,
|
|
oldid: 37,
|
|
pointerOlderPos: 1,
|
|
pointerNewerPos: 3,
|
|
sliderPos: NaN
|
|
}
|
|
);
|
|
} );
|