mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-12 07:25:13 +00:00
d5809a08c2
Change-Id: I5aa8d951e8fb77321748af341a1a17277aad9820
28 lines
720 B
JavaScript
28 lines
720 B
JavaScript
( function ( mw ) {
|
|
var RevisionList = mw.libs.revisionSlider.RevisionList;
|
|
|
|
QUnit.module( 'ext.RevisionSlider.RevisionList' );
|
|
|
|
QUnit.test( 'Find biggest Revision', function ( assert ) {
|
|
var revs = new RevisionList( [
|
|
{ size: 5 },
|
|
{ size: 21 },
|
|
{ size: 13 }
|
|
] );
|
|
|
|
assert.equal( revs.getBiggestChangeSize(), 16 );
|
|
} );
|
|
|
|
QUnit.test( 'calculate relative size on init', function ( assert ) {
|
|
var revs = new RevisionList( [
|
|
{ size: 5 },
|
|
{ size: 21 },
|
|
{ size: 13 }
|
|
] );
|
|
|
|
assert.equal( revs.getRevisions()[ 0 ].getRelativeSize(), 5 );
|
|
assert.equal( revs.getRevisions()[ 1 ].getRelativeSize(), 16 );
|
|
assert.equal( revs.getRevisions()[ 2 ].getRelativeSize(), -8 );
|
|
} );
|
|
} )( mediaWiki );
|