mediawiki-skins-MinervaNeue/tests/qunit/skins.minerva.scripts/test_PageIssuesOverlay.js
jdlrobson 0acfda1931 Don't send NaN as a value for sectionNumbers
The keyword "all" was being parsed as an integer incorrectly. To avoid this

Bug: T202940
Change-Id: I5553a4bb50cd7639c879f2c6e812fba25a216175
2018-08-28 18:26:09 +00:00

37 lines
977 B
JavaScript

( function ( M ) {
var PageIssuesOverlay = M.require( 'skins.minerva.scripts/PageIssuesOverlay' );
QUnit.module( 'Minerva PageIssuesOverlay', {
setup: 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( [], this.logger, '1', 0 );
overlay.onExit();
assert.strictEqual(
this.logger.log.calledWith( {
action: 'modalClose',
issuesSeverity: [],
sectionNumbers: [ '1' ]
} ), true, 'sectionNumbers is set'
);
} );
}( mw.mobileFrontend ) );