mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-12 07:25:13 +00:00
139368093e
The first revision was previously not included because revision size was calculated by subtracting the size in bytes of a revision from the size of the previous revision which lead to a problem with the first revision. The first revision's relative size is now equal to its actual size. Bug: T135003 Change-Id: I71441ed33673b06407be0fc566c96c3955dddbf9
29 lines
862 B
JavaScript
29 lines
862 B
JavaScript
( function ( mw ) {
|
|
var RevisionList = mw.libs.revisionSlider.RevisionList,
|
|
Revision = mw.libs.revisionSlider.Revision;
|
|
|
|
QUnit.module( 'ext.RevisionSlider.RevisionList' );
|
|
|
|
QUnit.test( 'Find biggest Revision', function ( assert ) {
|
|
var revs = new RevisionList( [
|
|
new Revision( { size: 5 } ),
|
|
new Revision( { size: 21 } ),
|
|
new Revision( { size: 13 } )
|
|
] );
|
|
|
|
assert.equal( revs.getBiggestChangeSize(), 16 );
|
|
} );
|
|
|
|
QUnit.test( 'calculate relative size on init', function ( assert ) {
|
|
var revs = new RevisionList( [
|
|
new Revision( { size: 5 } ),
|
|
new Revision( { size: 21 } ),
|
|
new Revision( { size: 13 } )
|
|
] );
|
|
|
|
assert.equal( revs.getRevisions()[ 0 ].getRelativeSize(), 5 );
|
|
assert.equal( revs.getRevisions()[ 1 ].getRelativeSize(), 16 );
|
|
assert.equal( revs.getRevisions()[ 2 ].getRelativeSize(), -8 );
|
|
} );
|
|
} )( mediaWiki );
|