Skip to content

Commit

Permalink
Merge pull request #5464 from perlpunk/group-overview-distri
Browse files Browse the repository at this point in the history
Ensure all hidden form fields in test overview filter
  • Loading branch information
mergify[bot] authored Feb 8, 2024
2 parents 199e451 + 1471ceb commit 46cfab2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion assets/javascripts/filter_form.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function setupFilterForm(options) {
function parseFilterArguments(paramHandler) {
var varPairs = window.location.search.substring(1).split('&');
var filterLabels = [];
var hiddenInputs = [];
for (var j = 0; j < varPairs.length; ++j) {
var pair = varPairs[j].split('=');
if (pair.length > 1) {
Expand All @@ -47,10 +48,13 @@ function parseFilterArguments(paramHandler) {
input.attr('value', val);
input.attr('name', key);
input.attr('hidden', true);
$('#filter-form').append(input);
hiddenInputs.push(input);
}
}
}
for (var i = 0; i < hiddenInputs.length; i++) {
$('#filter-form').append(hiddenInputs[i]);
}
if (filterLabels.length > 0) {
$('#filter-panel .card-header')
.find('span')
Expand Down
3 changes: 3 additions & 0 deletions t/ui/10-tests_overview.t
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,9 @@ subtest 'filtering by distri' => sub {
'foo/opensuse/bar 13.1',
'filter also visible in summary'
);
my $form_inputs = $driver->find_elements('#filter-form input');
my @distris = grep { $_->get_attribute('name') eq 'distri' && $_->get_attribute('hidden') } @$form_inputs;
is scalar(@distris), 3, 'Got expected number of distri form fields';
};

subtest 'everything filtered out' => sub {
Expand Down

0 comments on commit 46cfab2

Please sign in to comment.