Skip to content

Commit

Permalink
HTML Reporter: Fix <label> to wrap <select> for multi-value urlCo…
Browse files Browse the repository at this point in the history
…nfig item

Cherry-picked from 80a1695 (3.0.0-dev):
> Details and screenshot at #1773.

Also includes a partial cherry-pick from 57c2dbc to improve the
`test/reporter-urlparams.js` file with a menu case, to ease manual
testing of this behavior.
  • Loading branch information
Krinkle committed Dec 5, 2024
1 parent 2cd038e commit f78da46
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/html-reporter/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const stats = {
} else {
urlConfigHtml += "<label for='qunit-urlconfig-" + escaped +
"' title='" + escapedTooltip + "'>" + escapeText(val.label) +
": </label><select id='qunit-urlconfig-" + escaped +
": <select id='qunit-urlconfig-" + escaped +
"' name='" + escaped + "' title='" + escapedTooltip + "'><option></option>";

if (Array.isArray(val.value)) {
Expand Down Expand Up @@ -166,7 +166,7 @@ const stats = {
urlConfigHtml += "<option value='" + escaped +
"' selected='selected' disabled='disabled'>" + escaped + '</option>';
}
urlConfigHtml += '</select>';
urlConfigHtml += '</select></label>';
}
}

Expand Down
17 changes: 15 additions & 2 deletions test/reporter-urlparams.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,23 @@
if (!location.search) {
location.replace('?implicit&explicit=yes&array=A&array=B&escaped%20name&toString=string&' +
'module=urlParams+module&filter=urlParams%20module&notrycatch&' +
'custom&customArray=a&customArray=b');
'custom&customArray=a&customArray=b&customMenu=b&customMenuUnknown=c');
}

QUnit.config.urlConfig.push('custom', 'customArray');
QUnit.config.urlConfig.push(
'custom',
'customArray',
{
id: 'customMenu',
label: 'Menu',
value: ['a', 'b']
},
{
id: 'customMenuUnknown',
label: 'Menu unknown',
value: ['a', 'b']
}
);

// Don't change this module name without also changing the module parameter when loading this suite
QUnit.module('urlParams module', function () {
Expand Down

0 comments on commit f78da46

Please sign in to comment.