diff options
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/admin.t | 20 | ||||
-rw-r--r-- | t/app/controller/report_inspect.t | 12 |
2 files changed, 32 insertions, 0 deletions
diff --git a/t/app/controller/admin.t b/t/app/controller/admin.t index 075ab0fd0..bd0f9e408 100644 --- a/t/app/controller/admin.t +++ b/t/app/controller/admin.t @@ -1470,6 +1470,7 @@ subtest "response priorities can be added" => sub { name => "Cat 1A", description => "Fixed within 24 hours", deleted => undef, + is_default => undef, "contacts[".$oxfordshirecontact->id."]" => 1, }; $mech->submit_form_ok( { with_fields => $fields } ); @@ -1478,6 +1479,25 @@ subtest "response priorities can be added" => sub { is $oxfordshirecontact->response_priorities->count, 1, "Response template was added to contact"; }; +subtest "response priorities can set to default" => sub { + my $priority_id = $oxfordshire->response_priorities->first->id; + is $oxfordshire->response_priorities->count, 1, "Response priority exists"; + $mech->get_ok( "/admin/responsepriorities/" . $oxfordshire->id . "/$priority_id" ); + + my $fields = { + name => "Cat 1A", + description => "Fixed within 24 hours", + deleted => undef, + is_default => 1, + "contacts[".$oxfordshirecontact->id."]" => 1, + }; + $mech->submit_form_ok( { with_fields => $fields } ); + + is $oxfordshire->response_priorities->count, 1, "Still one response priority"; + is $oxfordshirecontact->response_priorities->count, 1, "Still one response template"; + ok $oxfordshire->response_priorities->first->is_default, "Response priority set to default"; +}; + subtest "response priorities can be listed" => sub { $mech->get_ok( "/admin/responsepriorities/" . $oxfordshire->id ); diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t index 68f9063cf..5bbbdff79 100644 --- a/t/app/controller/report_inspect.t +++ b/t/app/controller/report_inspect.t @@ -226,6 +226,18 @@ FixMyStreet::override_config { $user->user_body_permissions->search({ body_id => $oxon->id, permission_type => 'planned_reports' })->delete; }; + subtest "default response priorities display correctly" => sub { + $mech->get_ok("/report/$report_id"); + $mech->content_contains('Priority</label', 'report priority list present'); + like $mech->content, qr/<select name="priority" id="problem_priority" class="form-control">[^<]*<option value="" selecte/s, 'blank priority option is selected'; + $mech->content_lacks('value="' . $rp->id . '" selected>High', 'non default priority not selected'); + + $rp->update({ is_default => 1}); + $mech->get_ok("/report/$report_id"); + unlike $mech->content, qr/<select name="priority" id="problem_priority" class="form-control">[^<]*<option value="" selecte/s, 'blank priority option not selected'; + $mech->content_contains('value="' . $rp->id . '" selected>High', 'default priority selected'); + }; + foreach my $test ( { type => 'report_edit_priority', priority => 1 }, { type => 'report_edit_category', category => 1 }, |