Skip to content

Commit 62af1fa

Browse files
committed
Adjust labels for routes goto selections
1 parent 4aa1b04 commit 62af1fa

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

app/services/routes/build_service.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def build_routes_for_selection_page(page, conditions_by_key)
7676
answer_value:,
7777
goto: goto_value_for(condition),
7878
goto_options: options_for_goto_page(page, condition&.goto_page_id),
79-
label: { text: "Option #{index}: #{answer_value_label}" },
79+
label: { text: "If option #{index} (#{answer_value_label}), go to:" },
8080
)
8181
end
8282
end
@@ -92,7 +92,7 @@ def build_route_for_generic_page(page, conditions_by_key)
9292
page:,
9393
goto: goto_value_for(condition),
9494
goto_options: options_for_goto_page(page, condition&.goto_page_id),
95-
label: { text: "Go to", hidden: true },
95+
label: { text: "After question #{page.position}, go to:" },
9696
),
9797
]
9898
end

spec/services/routes/build_service_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
it "sets the label correctly for a generic page" do
4040
route_for_page1 = service.build_routes.first
41-
expect(route_for_page1.label).to eq({ text: "Go to", hidden: true })
41+
expect(route_for_page1.label).to eq({ text: "After question #{pages.first.position}, go to:" })
4242
end
4343

4444
context "when a condition exists for the generic page" do
@@ -117,10 +117,10 @@
117117
route_for_no = routes_for_page1.find { |r| r.answer_value == "No" }
118118

119119
expect(route_for_yes.goto).to eq(Forms::RouteInput::DEFAULT_VALUE)
120-
expect(route_for_yes.label).to eq({ text: "Option 1: Yes" })
120+
expect(route_for_yes.label).to eq({ text: "If option 1 (Yes), go to:" })
121121

122122
expect(route_for_no.goto).to eq(Forms::RouteInput::DEFAULT_VALUE)
123-
expect(route_for_no.label).to eq({ text: "Option 2: No" })
123+
expect(route_for_no.label).to eq({ text: "If option 2 (No), go to:" })
124124
end
125125

126126
context "when the selection page has more than 10 options" do
@@ -154,7 +154,7 @@
154154

155155
none_of_the_above_route = routes_for_page1.find { |r| r.answer_value == "none_of_the_above" }
156156
expect(none_of_the_above_route).not_to be_nil
157-
expect(none_of_the_above_route.label[:text]).to eq("Option 3: None of the above")
157+
expect(none_of_the_above_route.label[:text]).to eq("If option 3 (None of the above), go to:")
158158
end
159159
end
160160

@@ -207,7 +207,7 @@
207207
expect(route_for_page1).to be_a(Forms::RouteInput)
208208
expect(route_for_page1.page_id).to eq(pages.first.id)
209209
expect(route_for_page1.answer_value).to be_nil
210-
expect(route_for_page1.label).to eq({ text: "Go to", hidden: true })
210+
expect(route_for_page1.label).to eq({ text: "After question #{pages.first.position}, go to:" })
211211
end
212212
end
213213
end

0 commit comments

Comments
 (0)