Skip to content

Commit

Permalink
handle back button from the results page
Browse files Browse the repository at this point in the history
back button test
  • Loading branch information
willc-work committed Oct 16, 2024
1 parent 9793c30 commit bb51410
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/views/results/show.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
= t(@check.controlled? ? ".controlled_qualifies" : ".likely_to_qualify")

- content_for :back do
= link_to t("generic.back"), check_answers_path(assessment_code: params[:assessment_code]), class: "govuk-back-link"
- if FeatureFlags.enabled?(:ee_banner, @check.session_data) && @early_result_type
= back_link(@previous_step, true)
-else
= link_to t("generic.back"), check_answers_path(assessment_code: params[:assessment_code]), class: "govuk-back-link"

.govuk-grid-column-full
= render "shared/heading"
Expand Down
12 changes: 12 additions & 0 deletions spec/flows/early_result_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@
expect(page).to have_content "Your client's key eligibility totals"
end

it "when I go straight to results and use the back button it shows the banner" do
confirm_screen("outgoings")
outgoings_url = current_path
expect(page).to have_content("Gross monthly income limit exceeded")
click_on "Go to results page"
expect(page).to have_current_path(/\A\/check-result/)
expect(page).to have_content "Your client's key eligibility totals"
visit outgoings_url # simulates using the back button to return to outgoings
expect(page).to have_content("Gross monthly income limit exceeded by")
expect(page).to have_content("Go to results page")
end

context "when the early eligibility changes" do
it "back links and banner work as expected" do
confirm_screen("outgoings")
Expand Down

0 comments on commit bb51410

Please sign in to comment.