Skip to content

Commit e15ef5d

Browse files
authored
Merge pull request #2042 from alphagov/348-add-a-banner-notification-warning-to-the-confirmation-page-when-deleting-a-route-that-goes-to-an-exit-page
Add notification banner when deleting route with exit page
2 parents 34093ed + 628e9ed commit e15ef5d

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

app/views/pages/conditions/delete.html.erb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
<%= govuk_notification_banner(title_text: t("banner.default.title")) do |banner| %>
1111
<% banner.with_heading(text: t(".any_other_answer_warning")) %>
1212
<% end %>
13+
<% elsif delete_condition_input.record.exit_page? %>
14+
<%= govuk_notification_banner(title_text: t("banner.default.title")) do |banner| %>
15+
<% banner.with_heading(text: t(".exit_page_warning")) %>
16+
<% end %>
1317
<% end %>
1418

1519
<h1 class="govuk-heading-l">
@@ -28,7 +32,7 @@
2832
end;
2933
summary_list.with_row do |row|
3034
row.with_key { t(".skip_to_key") }
31-
row.with_value { delete_condition_input.goto_page_question_text }
35+
row.with_value { delete_condition_input.record.exit_page? ? delete_condition_input.record.exit_page_heading : delete_condition_input.goto_page_question_text }
3236
end;
3337

3438
end %>

config/locales/en.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,7 @@ en:
12041204
answered_as_key: is answered as
12051205
any_other_answer_warning: If you delete this route, the route for any other answer will also be deleted
12061206
delete_condition_legend: Are you sure you want to delete this route?
1207+
exit_page_warning: If you delete this route, the exit page it goes to will also be deleted
12071208
skip_to_key: skip the person to
12081209
edit:
12091210
back_link: Back to question %{question_number}’s routes

spec/views/pages/conditions/delete.html.erb_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,16 @@
9393
end
9494
end
9595
end
96+
97+
context "when the condition has an exit page" do
98+
let(:condition) { build :condition, :with_exit_page, id: 1, routing_page_id: pages.first.id, check_page_id: pages.first.id }
99+
100+
it "renders a warning about the exit page" do
101+
expect(rendered).to have_css ".govuk-notification-banner", text: "If you delete this route, the exit page it goes to will also be deleted"
102+
end
103+
104+
it "shows the exit page heading in the summary list" do
105+
expect(rendered).to have_css(".govuk-summary-list__value", text: condition.exit_page_heading)
106+
end
107+
end
96108
end

0 commit comments

Comments
 (0)