diff --git a/app/views/pages/selection/type.html.erb b/app/views/pages/selection/type.html.erb index 8be052e3da..5bd5997f7f 100644 --- a/app/views/pages/selection/type.html.erb +++ b/app/views/pages/selection/type.html.erb @@ -7,12 +7,13 @@ <% if @page.present? && @page.routing_conditions.any? %> <% if @selection_type_input.need_to_reduce_options? %> <%= govuk_notification_banner(title_text: t("banner.default.title")) do |banner| %> - <% banner.with_heading(text: t("selection_type.routing_and_reduce_your_options_combined_warning.heading"), tag: "h3") %> + <% routes = t("selection_type.routes", count: @page.routing_conditions.count) %> + <% banner.with_heading(text: t("selection_type.routing_and_reduce_your_options_combined_warning.heading", routes:), tag: "h3") %>
<%= t("selection_type.routing_and_reduce_your_options_combined_warning.body", pages_link_url: form_pages_path(current_form.id)) %>
<% end %> <% elsif @selection_type_input.show_routing_warning? %> <%= govuk_notification_banner(title_text: t("banner.default.title")) do |banner| %> - <% banner.with_heading(text: t("selection_type.routing_warning")) %> + <% banner.with_heading(text: t("selection_type.routing_warning", count: @page.routing_conditions.count)) %> <% end %> <% end %> <% elsif @selection_type_input.need_to_reduce_options? %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 4c27868a96..8414508b29 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2308,13 +2308,18 @@ en: up_to_3000_options: You can have up to 3,000 options. up_to_30_options: You can have up to 30 options. selection_type: + routes: + one: route + other: routes reduce_your_options_warning: body: You can only have up to 30 options in a list where people can select one or more options. If you make this change, you’ll be able to edit your list on the next page. - heading: If you change this to ‘one or more options’, you’ll need to edit your list + heading: If you change this to ‘One or more options’, you’ll need to edit your list routing_and_reduce_your_options_combined_warning: body: You can only have up to 30 options in a list where people can select one or more options. If you make this change, you’ll be able to edit your list on the next page. - heading: If you change this to ‘one or more options’, the route from this question will be deleted and you’ll need to edit the list - routing_warning: If you change this to ‘one or more options’, the route from this question will be deleted + heading: If you change this to ‘One or more options’, this question’s %{routes} will be deleted and you’ll need to edit the list + routing_warning: + one: If you change this to ‘One or more options’, this question’s route will be deleted + other: If you change this to ‘One or more options’, this question’s routes will be deleted set_email: new: body_html: | diff --git a/spec/views/pages/selection/type.html.erb_spec.rb b/spec/views/pages/selection/type.html.erb_spec.rb index 8850c1d329..84c25419d3 100644 --- a/spec/views/pages/selection/type.html.erb_spec.rb +++ b/spec/views/pages/selection/type.html.erb_spec.rb @@ -91,7 +91,15 @@ context "when show_routing_warning returns true" do it "displays a warning about routes being deleted" do - expect(rendered).to have_selector(".govuk-notification-banner__content", text: I18n.t("selection_type.routing_warning")) + expect(rendered).to have_selector(".govuk-notification-banner__content", text: I18n.t("selection_type.routing_warning", count: 1)) + end + + context "with more than one route from options" do + let(:routing_conditions) { build_list(:condition, 3) } + + it "displays a warning about routes being deleted" do + expect(rendered).to have_selector(".govuk-notification-banner__content", text: I18n.t("selection_type.routing_warning", count: 3)) + end end end @@ -111,7 +119,15 @@ end it "displays a combined warning about routes being deleted and needing to reduce the options" do - expect(rendered).to have_selector(".govuk-notification-banner__content", text: I18n.t("selection_type.routing_and_reduce_your_options_combined_warning.heading")) + expect(rendered).to have_selector(".govuk-notification-banner__content", text: I18n.t("selection_type.routing_and_reduce_your_options_combined_warning.heading", routes: "route")) + end + + context "with more than one route from options" do + let(:routing_conditions) { build_list(:condition, 3) } + + it "displays a combined warning about routes being deleted and needing to reduce the options" do + expect(rendered).to have_selector(".govuk-notification-banner__content", text: I18n.t("selection_type.routing_and_reduce_your_options_combined_warning.heading", routes: "routes")) + end end end end