mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-09-24 02:38:29 +00:00
Merge "page-issues sectionNumbers consistency on modalClose event"
This commit is contained in:
commit
002160ae9c
|
@ -85,10 +85,19 @@
|
|||
* @return {void}
|
||||
*/
|
||||
onExit: function () {
|
||||
this.log( {
|
||||
action: 'modalClose',
|
||||
issuesSeverity: this.issues.map( issueSummaryToSeverity )
|
||||
} );
|
||||
var logData = {
|
||||
action: 'modalClose',
|
||||
issuesSeverity: this.issues.map( issueSummaryToSeverity )
|
||||
},
|
||||
currentSection = this.section;
|
||||
// When users close the modal, `sectionNumbers` should correlate to each visible issue in
|
||||
// the modal, provided that this.section is a valid number and not `KEYWORD_ALL_SECTIONS`.
|
||||
if ( this.section !== KEYWORD_ALL_SECTIONS ) {
|
||||
logData.sectionNumbers = this.issues.map( function () {
|
||||
return currentSection;
|
||||
} );
|
||||
}
|
||||
this.log( logData );
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,15 +22,36 @@
|
|||
} );
|
||||
|
||||
QUnit.test( '#log (section=1)', function ( assert ) {
|
||||
var overlay = new PageIssuesOverlay( [], this.logger, '1', 0 );
|
||||
var overlay = new PageIssuesOverlay( [
|
||||
{
|
||||
severity: 'MEDIUM'
|
||||
}
|
||||
], this.logger, '1', 0 );
|
||||
overlay.onExit();
|
||||
assert.strictEqual(
|
||||
this.logger.log.calledWith( {
|
||||
action: 'modalClose',
|
||||
issuesSeverity: [],
|
||||
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 ) );
|
||||
|
|
Loading…
Reference in a new issue