mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-15 19:49:30 +00:00
e62f46dd80
Bug: T208951 Change-Id: Icf10ea6bbc09542e69c0cd583a4ee4f2f76a3f43
48 lines
1.1 KiB
JavaScript
48 lines
1.1 KiB
JavaScript
( function () {
|
|
var DiffPage = mw.libs.revisionSlider.DiffPage,
|
|
SliderView = mw.libs.revisionSlider.SliderView,
|
|
Slider = mw.libs.revisionSlider.Slider,
|
|
RevisionList = mw.libs.revisionSlider.RevisionList,
|
|
Revision = mw.libs.revisionSlider.Revision;
|
|
|
|
QUnit.module( 'ext.RevisionSlider.DiffPage' );
|
|
|
|
QUnit.test( 'Initialize DiffPage', function ( assert ) {
|
|
assert.ok( ( new DiffPage() ) );
|
|
} );
|
|
|
|
QUnit.test( 'Push state', function ( assert ) {
|
|
var histLength,
|
|
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>' ) );
|
|
|
|
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
|
|
}
|
|
);
|
|
} );
|
|
|
|
}() );
|