mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-18 18:00:44 +00:00
f5de8ee108
* eslint-config-wikimedia: 0.27.0 → 0.28.0 The following rules are failing and were disabled: * modules: * no-mixed-spaces-and-tabs * no-jquery/no-extend * implicit-arrow-linebreak * tests/qunit: * no-jquery/no-extend * grunt-stylelint: 0.19.0 → 0.20.0 * stylelint-config-wikimedia: 0.16.1 → 0.17.1 Change-Id: I3fd3c4a2cbb03d3aa4c8efb658e33d14d24cd518
41 lines
965 B
JavaScript
41 lines
965 B
JavaScript
QUnit.module( 'ext.RevisionSlider.DiffPage' );
|
|
|
|
QUnit.test( 'Push state', ( assert ) => {
|
|
const SliderModule = require( 'ext.RevisionSlider.Slider' ),
|
|
DiffPage = SliderModule.DiffPage,
|
|
SliderView = SliderModule.SliderView,
|
|
Slider = SliderModule.Slider,
|
|
RevisionList = SliderModule.RevisionList,
|
|
Revision = SliderModule.Revision;
|
|
|
|
const 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>' ) );
|
|
|
|
const 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
|
|
}
|
|
);
|
|
} );
|