diff options
author | Dave Arter <davea@mysociety.org> | 2019-11-27 11:59:20 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-01-30 11:43:47 +0000 |
commit | 82346b798099d4662528a63fbfb355aa991a0ea7 (patch) | |
tree | 780ad83c321bcddceb80c0b69ef19b7194ed1cd5 /t | |
parent | c82b1734cd2b5f224e3d4779972e4dcdefb41c7f (diff) |
Enable category groups on map filter dropdown.
Includes an updated version of jquery-multi-select.
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/around.t | 8 | ||||
-rw-r--r-- | t/app/controller/reports.t | 5 |
2 files changed, 12 insertions, 1 deletions
diff --git a/t/app/controller/around.t b/t/app/controller/around.t index a9c008c9d..bd2bf2cee 100644 --- a/t/app/controller/around.t +++ b/t/app/controller/around.t @@ -232,7 +232,11 @@ 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 ) { - $mech->create_contact_ok( category => $category, body_id => $body->id, email => "$category\@example.org" ); + my $contact = $mech->create_contact_ok( category => $category, body_id => $body->id, email => "$category\@example.org" ); + if ($category ne 'Pothole') { + $contact->set_extra_metadata(group => ['Environment']); + $contact->update; + } foreach my $state ( 'confirmed', 'fixed - user', 'fixed - council' ) { my %report_params = ( %$params, @@ -252,9 +256,11 @@ subtest 'check category, status and extra filtering works on /around' => sub { FixMyStreet::override_config { ALLOWED_COBRANDS => 'fixmystreet', MAPIT_URL => 'http://mapit.uk/', + COBRAND_FEATURES => { category_groups => { fixmystreet => 1 } }, }, sub { $mech->get_ok( '/around?filter_category=Pothole&bbox=' . $bbox ); $mech->content_contains('<option value="Pothole" selected>'); + $mech->content_contains('<optgroup label="Environment">'); }; $json = $mech->get_ok_json( '/around?ajax=1&filter_category=Pothole&bbox=' . $bbox ); diff --git a/t/app/controller/reports.t b/t/app/controller/reports.t index 670c5cfc3..1d9c8d216 100644 --- a/t/app/controller/reports.t +++ b/t/app/controller/reports.t @@ -18,6 +18,9 @@ my $body_west_id = $mech->create_body_ok(2504, 'Westminster City Council')->id; my $body_fife_id = $mech->create_body_ok(2649, 'Fife Council')->id; my $body_slash_id = $mech->create_body_ok(10000, 'Electricity/Gas Council')->id; +$mech->create_contact_ok(body_id => $body_edin_id, category => 'Potholes', email => 'potholes@example.org'); +$mech->create_contact_ok(body_id => $body_west_id, category => 'Graffiti', email => 'graffiti@example.org'); +$mech->create_contact_ok(body_id => $body_fife_id, category => 'Flytipping', email => 'flytipping@example.org'); my @edinburgh_problems = $mech->create_problems_for_body(3, $body_edin_id, 'All reports', { category => 'Potholes' }); my @westminster_problems = $mech->create_problems_for_body(5, $body_west_id, 'All reports', { category => 'Graffiti' }); my @fife_problems = $mech->create_problems_for_body(15, $body_fife_id, 'All reports', { category => 'Flytipping' }); @@ -128,9 +131,11 @@ $mech->content_contains('2,3,4,4'); FixMyStreet::override_config { ALLOWED_COBRANDS => 'fixmystreet', MAPIT_URL => 'http://mapit.uk/', + COBRAND_FEATURES => { category_groups => { fixmystreet => 1 } }, }, sub { $mech->submit_form_ok( { with_fields => { body => $body_edin_id } }, 'Submitted dropdown okay' ); is $mech->uri->path, '/reports/City+of+Edinburgh'; + $mech->content_contains('<optgroup label="">'); subtest "test ward pages" => sub { $mech->get_ok('/reports/Birmingham/Bad-Ward'); |