page-issues sectionNumbers consistency on modalClose event
For the page-issues modalClose event, the number of values for `sectionNumbers` and `issuesSeverity` should be the same, since `sectionNumbers` should describe the the section of each visible issue in the modal, not the section of the modal itself. Bug: T203050 Change-Id: Ic58c5940a6059e71aa3aeed26232afbe8faf1618
This commit is contained in:
parent
34ead3f8c5
commit
1a9bcd1e8a
@ -85,10 +85,19 @@
|
||||
* @return {void}
|
||||
*/
|
||||
onExit: function () {
|
||||
this.log( {
|
||||
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 New Issue
Block a user