Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change labels for routes in page list #1754

Merged
merged 2 commits into from
Feb 10, 2025
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
2 changes: 1 addition & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ en:
condition_goto_page_check_your_answers: "“Check your answers before submitting”."
condition_goto_page_text: "%{goto_page_position}, “%{goto_page_text}”"
condition_goto_page_text_with_errors: "[Question not selected]"
condition_name: Route %{route_index} of question %{page_index}’s routes
condition_name: Question %{page_index}’s routes
errors:
error_summary:
answer_value_doesnt_exist: The answer that question %{page_index}’s route is based on no longer exists - edit question %{page_index}’s route
Expand Down
38 changes: 19 additions & 19 deletions spec/components/page_list_component/page_list_component_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@ def default
end

def with_pages_and_no_conditions
pages = [OpenStruct.new(id: 1, position: 1, question_text: "Enter your name", conditions: []),
OpenStruct.new(id: 2, position: 2, question_text: "What is your pet's phone number?", conditions: []),
OpenStruct.new(id: 3, position: 3, question_text: "How many pets do you own?", conditions: [])]
pages = [build(:page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: []),
build(:page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: []),
build(:page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])]
render(PageListComponent::View.new(pages:, form_id: 0))
end

def with_pages_and_one_condition
conditions = [(build :condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3)]
pages = [OpenStruct.new(id: 1, position: 1, question_text: "Enter your name", conditions:),
OpenStruct.new(id: 2, position: 2, question_text: "What is your pet's phone number?", conditions: []),
OpenStruct.new(id: 3, position: 3, question_text: "How many pets do you own?", conditions: [])]
routing_conditions = [(build :condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3)]
pages = [build(:page, id: 1, position: 1, question_text: "Enter your name", routing_conditions:),
build(:page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: []),
build(:page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])]
render(PageListComponent::View.new(pages:, form_id: 0))
end

def with_pages_and_multiple_conditions
routing_conditions_1 = [(build :condition, id: 1, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3),
(build :condition, id: 2, routing_page_id: 1, check_page_id: 1, answer_value: "England", goto_page_id: 2)]
routing_conditions_2 = [(build :condition, id: 3, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 3),
(build :condition, id: 4, routing_page_id: 1, check_page_id: 1, answer_value: "England", goto_page_id: 2)]
pages = [(build :page, id: 1, question_text: "Enter your name", routing_conditions: routing_conditions_1),
(build :page, id: 2, question_text: "What is your pet's phone number?", routing_conditions: routing_conditions_2),
(build :page, id: 3, question_text: "How many pets do you own?", routing_conditions: [])]
routing_conditions_2 = [(build :condition, id: 3, routing_page_id: 2, check_page_id: 2, answer_value: "Wales", goto_page_id: 3),
(build :condition, id: 4, routing_page_id: 2, check_page_id: 2, answer_value: "England", goto_page_id: 2)]
pages = [(build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: routing_conditions_1),
(build :page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: routing_conditions_2),
(build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])]
render(PageListComponent::View.new(pages:, form_id: 0))
end

def with_pages_and_conditions_with_errors
routing_conditions = [(build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3),
(build :condition, :with_goto_page_missing, id: 2, routing_page_id: 1, check_page_id: 1, answer_value: "England"),
(build :condition, :with_answer_value_and_goto_page_missing, id: 3, routing_page_id: 1, check_page_id: 1),
(build :condition, :with_goto_page_before_check_page, id: 4, routing_page_id: 2, check_page_id: 2, answer_value: "England", goto_page_id: 1),
(build :condition, :with_goto_page_immediately_after_check_page, id: 5, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 2)]
pages = [(build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions:),
(build :page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: []),
routing_conditions_1 = [(build :condition, :with_answer_value_missing, id: 1, routing_page_id: 1, check_page_id: 1, goto_page_id: 3),
(build :condition, :with_goto_page_missing, id: 2, routing_page_id: 1, check_page_id: 1, answer_value: "England"),
(build :condition, :with_answer_value_and_goto_page_missing, id: 3, routing_page_id: 1, check_page_id: 1),
(build :condition, :with_goto_page_immediately_after_check_page, id: 5, routing_page_id: 1, check_page_id: 1, answer_value: "Wales", goto_page_id: 2)]
routing_conditions_2 = [(build :condition, :with_goto_page_before_check_page, id: 4, routing_page_id: 2, check_page_id: 2, answer_value: "England", goto_page_id: 1)]
pages = [(build :page, id: 1, position: 1, question_text: "Enter your name", routing_conditions: routing_conditions_1),
(build :page, id: 2, position: 2, question_text: "What is your pet's phone number?", routing_conditions: routing_conditions_2),
(build :page, id: 3, position: 3, question_text: "How many pets do you own?", routing_conditions: [])]
render(PageListComponent::View.new(pages:, form_id: 0))
end
Expand Down