aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-05-19 12:15:24 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-05-26 13:34:38 +0100
commit9e7c44777e9fbcbef6be463b4a7a1dc9b20d90f1 (patch)
treeab709d5975a9b61c2778559be59e76f8beb015ec /t
parent36baff2d6ea23dc6648160ce82e40e0e9f6d7bda (diff)
Make sure existing state is included in drop-down.
It is possible the report's state isn't one that the user can access, but in that case we should still show it to avoid confusion.
Diffstat (limited to 't')
-rw-r--r--t/app/controller/report_inspect.t12
1 files changed, 11 insertions, 1 deletions
diff --git a/t/app/controller/report_inspect.t b/t/app/controller/report_inspect.t
index 9d2ae0b0f..e1723b0cd 100644
--- a/t/app/controller/report_inspect.t
+++ b/t/app/controller/report_inspect.t
@@ -227,13 +227,23 @@ FixMyStreet::override_config {
is $report->get_extra_metadata('traffic_information'), 'Signs and Cones', 'report data changed';
};
- subtest "No action scheduled without the right permission" => sub {
+ subtest "Action scheduled only shown appropriately" => sub {
$report->update({ state => 'confirmed' });
$mech->get_ok("/report/$report_id");
$mech->content_lacks('action scheduled');
+ # If the report is already in that state, though, we should show it
+ $report->update({ state => 'action scheduled' });
+ $mech->get_ok("/report/$report_id");
+ $mech->content_unlike(qr/<optgroup label="Scheduled">\s*<option value="action scheduled">Action Scheduled<\/option>/);
+ $mech->content_contains('<option selected value="action scheduled">Action Scheduled</option>');
+
$user->user_body_permissions->create({ body => $oxon, permission_type => 'report_instruct' });
$mech->get_ok("/report/$report_id");
+ $mech->content_like(qr/<optgroup label="Scheduled">\s*<option selected value="action scheduled">Action Scheduled<\/option>/);
+
+ $report->update({ state => 'confirmed' });
+ $mech->get_ok("/report/$report_id");
$mech->content_like(qr/<optgroup label="Scheduled">\s*<option value="action scheduled">Action Scheduled<\/option>/);
};