Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/services/step_summary_card_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ def route_value
def print_route(condition)
answer_value = ActionController::Base.helpers.sanitize(condition.answer_value)

if condition.skip_to_end
if condition.skip_to_end && condition.secondary_skip?
I18n.t("page_conditions.condition_compact_html_secondary_skip_to_end_of_form")
elsif condition.skip_to_end
I18n.t("page_conditions.condition_compact_html_end_of_form", answer_value:).html_safe
elsif condition.secondary_skip?
goto_question = @steps.find { |page| page.id == condition.goto_page_id }
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1253,6 +1253,7 @@ en:
condition_compact_html_end_of_form: If the answer is “%{answer_value}”<br> then skip to “Check your answers before submitting”
condition_compact_html_exit_page: If the answer is “%{answer_value}” go to the exit page, “%{exit_page_heading}”
condition_compact_html_secondary_skip: Go to %{goto_page_question_number}, “%{goto_page_question_text}”
condition_compact_html_secondary_skip_to_end_of_form: Go to “Check your answers before submitting”
condition_description: If %{check_page_question_text} is answered as %{answer_value} go to %{goto_page_question_text}
condition_goto_exit_page: exit page, “%{exit_page_heading}”
condition_goto_page_check_your_answers: "“Check your answers before submitting”."
Expand Down
21 changes: 21 additions & 0 deletions spec/services/step_summary_card_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,27 @@
end
end

context "with a secondary skip condition that points to the end of the form" do
let(:page) { pages.second }

before do
create :condition, routing_page_id: pages.first.id, check_page_id: pages.first.id, goto_page_id: pages.third.id, answer_value: "Option 1"
create :condition, routing_page_id: page.id, check_page_id: pages.first.id, skip_to_end: true

page.reload
form.reload.make_live!
end

it "returns the correct options" do
expect(step_summary_card_service.all_options_for_answer_type).to include(
{
key: { text: I18n.t("page_conditions.route") },
value: { text: I18n.t("page_conditions.condition_compact_html_secondary_skip_to_end_of_form") },
},
)
end
end

context "with a secondary skip" do
let(:page) { form.pages.second }

Expand Down