2016-05-03 10:03:38 +00:00
|
|
|
( function ( mw ) {
|
2016-04-28 10:18:52 +00:00
|
|
|
QUnit.module( 'ext.RevisionSlider.Revision' );
|
|
|
|
|
|
|
|
QUnit.test( 'create Revision', function ( assert ) {
|
|
|
|
var data = {
|
|
|
|
size: 5,
|
|
|
|
comment: 'hello',
|
|
|
|
parsedcomment: '<b>hello</b>',
|
|
|
|
timestamp: '2016-04-26T10:27:14Z', // 10:27, 26 Apr 2016
|
|
|
|
user: 'meh'
|
|
|
|
},
|
|
|
|
rev = new mw.libs.revisionSlider.Revision( data );
|
|
|
|
|
|
|
|
assert.equal( rev.getSize(), data.size );
|
|
|
|
assert.equal( rev.getComment(), data.comment );
|
|
|
|
assert.equal( rev.getParsedComment(), data.parsedcomment );
|
|
|
|
assert.equal( rev.getFormattedDate(), '10:27, 26 Apr 2016' );
|
|
|
|
assert.equal( rev.getUser(), data.user );
|
|
|
|
} );
|
|
|
|
|
2016-05-02 10:05:31 +00:00
|
|
|
QUnit.test( 'get Revision with section', function ( assert ) {
|
|
|
|
var data = {
|
2016-05-03 10:03:38 +00:00
|
|
|
comment: '/* section */ comment'
|
2016-05-02 10:05:31 +00:00
|
|
|
},
|
|
|
|
rev = new mw.libs.revisionSlider.Revision( data );
|
|
|
|
|
|
|
|
assert.equal( rev.getSection(), 'section' );
|
|
|
|
} );
|
|
|
|
|
|
|
|
QUnit.test( 'get Revision without section', function ( assert ) {
|
|
|
|
var data = {
|
|
|
|
comment: 'no section comment'
|
|
|
|
},
|
|
|
|
rev = new mw.libs.revisionSlider.Revision( data );
|
|
|
|
|
|
|
|
assert.equal( rev.getSection(), '' );
|
|
|
|
} );
|
2016-05-12 13:52:54 +00:00
|
|
|
|
|
|
|
QUnit.test( 'get and set relative size', function ( assert ) {
|
|
|
|
var size = 5,
|
|
|
|
rev = new mw.libs.revisionSlider.Revision( {} );
|
|
|
|
rev.setRelativeSize( size );
|
|
|
|
assert.equal( rev.getRelativeSize(), size );
|
|
|
|
} );
|
2016-05-03 10:03:38 +00:00
|
|
|
} )( mediaWiki );
|
2016-05-02 10:05:31 +00:00
|
|
|
|