diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-07-15 15:17:13 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-07-16 14:58:13 +0100 |
commit | 90afa8d790808979d1b1fd9c327e0139013b3b90 (patch) | |
tree | 7bd132276ce1fa9f7c80b923e982649ed66fbcb4 /t/app/controller | |
parent | 88c607fa378951491c7ec0f3384bc8f27fbca467 (diff) |
Select matches for both filter category and group.
If both are specified, we want to treat it as an AND, not an OR.
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/around.t | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/t/app/controller/around.t b/t/app/controller/around.t index e35406bb6..ba5f8c48a 100644 --- a/t/app/controller/around.t +++ b/t/app/controller/around.t @@ -250,7 +250,10 @@ subtest 'check category, status and extra filtering works on /around' => sub { # Create one open and one fixed report in each category foreach my $category ( @$categories ) { my $contact = $mech->create_contact_ok( category => $category, body_id => $body->id, email => "$category\@example.org" ); - if ($category ne 'Pothole') { + if ($category eq 'Vegetation') { + $contact->set_extra_metadata(group => ['Environment', 'Green']); + $contact->update; + } elsif ($category eq 'Flytipping') { $contact->set_extra_metadata(group => ['Environment']); $contact->update; } @@ -281,6 +284,9 @@ subtest 'check category, status and extra filtering works on /around' => sub { $mech->get_ok( '/around?filter_group=Environment&bbox=' . $bbox ); $mech->content_contains('<option value="Flytipping" selected>'); + + $mech->get_ok( '/around?filter_group=Environment&filter_category=Vegetation&bbox=' . $bbox ); + $mech->content_like(qr/<optgroup label="Environment">.*?<option value="Vegetation" selected>.*?<optgroup label="Green">.*?<option value="Vegetation">/s); }; $json = $mech->get_ok_json( '/around?ajax=1&filter_category=Pothole&bbox=' . $bbox ); |