mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-12-11 15:06:19 +00:00
308d24c8c5
Change-Id: Ice2d37f40105d082fd10ebc7a83bd1ef02919eb4
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
( function ( mw ) {
|
|
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 );
|
|
} );
|
|
|
|
QUnit.test( 'get Revision with section', function ( assert ) {
|
|
var data = {
|
|
comment: '/* section */ comment'
|
|
},
|
|
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(), '' );
|
|
} );
|
|
} )( mediaWiki );
|
|
|