mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-17 19:21:39 +00:00
2163d5f965
Updates QUnit test files from starting with "test_" to ending with "test.js" in accordance with the Readers Wed coding conventions. https://www.mediawiki.org/wiki/Reading/Web/Coding_conventions Bug: T197884 Change-Id: I98877e3fc432b6edd0c53d834ef23b3ef8fb7d6a
58 lines
1.4 KiB
JavaScript
58 lines
1.4 KiB
JavaScript
( function ( M ) {
|
|
var PageIssuesOverlay = M.require( 'skins.minerva.scripts/PageIssuesOverlay' );
|
|
|
|
QUnit.module( 'Minerva PageIssuesOverlay', {
|
|
beforeEach: function () {
|
|
this.logger = {
|
|
log: this.sandbox.spy()
|
|
};
|
|
}
|
|
} );
|
|
|
|
QUnit.test( '#log (section=all)', function ( assert ) {
|
|
var overlay = new PageIssuesOverlay( [], this.logger, 'all', 0 );
|
|
overlay.onExit();
|
|
assert.strictEqual( this.logger.log.calledOnce, true, 'Logger called once' );
|
|
assert.strictEqual(
|
|
this.logger.log.calledWith( {
|
|
action: 'modalClose',
|
|
issuesSeverity: []
|
|
} ), true, 'sectionNumbers is not set (T202940)'
|
|
);
|
|
} );
|
|
|
|
QUnit.test( '#log (section=1)', function ( assert ) {
|
|
var overlay = new PageIssuesOverlay( [
|
|
{
|
|
severity: 'MEDIUM'
|
|
}
|
|
], this.logger, '1', 0 );
|
|
overlay.onExit();
|
|
assert.strictEqual(
|
|
this.logger.log.calledWith( {
|
|
action: 'modalClose',
|
|
issuesSeverity: [ 'MEDIUM' ],
|
|
sectionNumbers: [ '1' ]
|
|
} ), true, 'sectionNumbers is set'
|
|
);
|
|
} );
|
|
|
|
QUnit.test( '#log (section=2) multiple issues', function ( assert ) {
|
|
var overlay = new PageIssuesOverlay(
|
|
[ {
|
|
severity: 'MEDIUM'
|
|
},
|
|
{
|
|
severity: 'LOW'
|
|
} ], this.logger, '2', 0 );
|
|
overlay.onExit();
|
|
assert.strictEqual(
|
|
this.logger.log.calledWith( {
|
|
action: 'modalClose',
|
|
issuesSeverity: [ 'MEDIUM', 'LOW' ],
|
|
sectionNumbers: [ '2', '2' ]
|
|
} ), true, 'sectionNumbers is set for each issue'
|
|
);
|
|
} );
|
|
}( mw.mobileFrontend ) );
|