From 9a015c7be61c59c5d05412b7ad36d3811bb042f9 Mon Sep 17 00:00:00 2001 From: Victoria Mihell-Hale Date: Thu, 26 Sep 2024 12:27:39 +0100 Subject: [PATCH] fixup! [Island Roads] Default 'CONFIRM Subject' to be a blank selection --- t/cobrand/isleofwight.t | 36 ++++++++ templates/web/base/admin/triage/_inspect.html | 89 +++++++------------ 2 files changed, 70 insertions(+), 55 deletions(-) diff --git a/t/cobrand/isleofwight.t b/t/cobrand/isleofwight.t index 04054663c8a..089ce96afdb 100644 --- a/t/cobrand/isleofwight.t +++ b/t/cobrand/isleofwight.t @@ -45,6 +45,7 @@ $contact->set_extra_fields( ( { order => 1, datatype_description => 'datatype', } ) ); +$contact->set_extra_metadata( group => ['Roads'] ); $contact->update; my $user = $mech->create_user_ok('user@example.org', name => 'Test User'); @@ -67,6 +68,10 @@ $admin_user->user_body_permissions->create({ body => $isleofwight, permission_type => 'triage' }); +$admin_user->user_body_permissions->create({ + body => $isleofwight, + permission_type => 'report_inspect', +}); my @reports = $mech->create_problems_for_body(1, $isleofwight->id, 'An Isle of wight report', { confirmed => '2019-10-25 09:00', @@ -590,6 +595,37 @@ subtest "reports are marked for triage upon submission" => sub { my $email = $mech->get_email; like $mech->get_text_body_from_email($email), qr/submitted to Island Roads for review/, 'correct text for email sent for Triage'; + + $mech->log_in_ok( $admin_user->email ); + $mech->get_ok( '/report/' . $report->id ); + $mech->content_contains( + '', + 'there is a "Roads" optgroup', + ); + $mech->content_contains( + '', + 'there is an empty-valued option selected by default', + ); + + $mech->submit_form( form_id => 'report_inspect_form' ); + $mech->text_contains( 'Please choose a category', + 'Form requires a category be chosen' ); + + $mech->submit_form( + form_id => 'report_inspect_form', + fields => { category => 1 }, # Pothole + ); + $mech->get_ok( '/report/' . $report->id ); + $mech->text_contains( + 'Report triaged from Roads to Potholes', + 'Update message describes triage', + ); + $mech->content_contains( + '[% END %] + [% group_select = 0 %] + [% selected = 0 %] - [% IF group_select == 0 AND problem.category == group.name %] - [% selected = 1; group_select = 1 %] - [% END %] - - - - [%~ FOREACH cat_op IN group.categories ~%] - - [% selected = 0 %] - [%~ END ~%] - [% IF group.name %][% END %] - [%~ END =%] - [% ELSE %] - [% FOREACH cat IN category_options %] - - [% END %] - [% END %] - [% END %] - - [% ELSE %] - - [% END %] + + [%~ FOREACH cat_op IN categories ~%] + [% IF group_select == 0 AND problem.category == group.name %] + [% selected = 1; group_select = 1 %] + [% END %] + + [% selected = 0 %] + [%~ END ~%] + [% IF group.name %][% END %] + [%~ END =%] + [% ELSE %] + [% FOREACH cat IN category_options %] + + [% END %] + [% END %] + [% END %] + [% END %] [% second_column = BLOCK -%]