2016-05-10 12:42:05 +00:00
|
|
|
( function ( mw ) {
|
2016-05-31 10:00:07 +00:00
|
|
|
var RevisionList = mw.libs.revisionSlider.RevisionList;
|
2016-05-10 12:42:05 +00:00
|
|
|
|
|
|
|
QUnit.module( 'ext.RevisionSlider.RevisionList' );
|
|
|
|
|
|
|
|
QUnit.test( 'Find biggest Revision', function ( assert ) {
|
|
|
|
var revs = new RevisionList( [
|
2016-05-31 10:00:07 +00:00
|
|
|
{ size: 5 },
|
|
|
|
{ size: 21 },
|
|
|
|
{ size: 13 }
|
2016-05-10 12:42:05 +00:00
|
|
|
] );
|
|
|
|
|
|
|
|
assert.equal( revs.getBiggestChangeSize(), 16 );
|
|
|
|
} );
|
2016-05-12 13:52:54 +00:00
|
|
|
|
|
|
|
QUnit.test( 'calculate relative size on init', function ( assert ) {
|
|
|
|
var revs = new RevisionList( [
|
2016-05-31 10:00:07 +00:00
|
|
|
{ size: 5 },
|
|
|
|
{ size: 21 },
|
|
|
|
{ size: 13 }
|
2016-05-12 13:52:54 +00:00
|
|
|
] );
|
|
|
|
|
|
|
|
assert.equal( revs.getRevisions()[ 0 ].getRelativeSize(), 5 );
|
|
|
|
assert.equal( revs.getRevisions()[ 1 ].getRelativeSize(), 16 );
|
|
|
|
assert.equal( revs.getRevisions()[ 2 ].getRelativeSize(), -8 );
|
|
|
|
} );
|
2016-05-10 12:42:05 +00:00
|
|
|
} )( mediaWiki );
|