From 0af23279931696eb9bab001ae564fad0ebae5168 Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Fri, 20 Oct 2023 10:26:26 +0100 Subject: [PATCH] CLDC-2640 Add location guidance (#1978) * Add location guidance * update content * Add question specs --- app/models/form/lettings/pages/location.rb | 1 + app/models/form/lettings/questions/location_id.rb | 1 + app/views/form/guidance/_finding_location.erb | 4 ++++ spec/models/form/lettings/pages/location_spec.rb | 2 +- .../form/lettings/questions/location_id_spec.rb | 11 +++++++++++ 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 app/views/form/guidance/_finding_location.erb diff --git a/app/models/form/lettings/pages/location.rb b/app/models/form/lettings/pages/location.rb index f20ca30d5..2c040661a 100644 --- a/app/models/form/lettings/pages/location.rb +++ b/app/models/form/lettings/pages/location.rb @@ -7,6 +7,7 @@ class Form::Lettings::Pages::Location < ::Form::Page "scheme_has_multiple_locations?" => true, }, ] + @header = "Location" @next_unresolved_page_id = :check_answers end diff --git a/app/models/form/lettings/questions/location_id.rb b/app/models/form/lettings/questions/location_id.rb index 6e5ed3dc0..62ee0d218 100644 --- a/app/models/form/lettings/questions/location_id.rb +++ b/app/models/form/lettings/questions/location_id.rb @@ -13,6 +13,7 @@ class Form::Lettings::Questions::LocationId < ::Form::Question } @question_number = 10 @disable_clearing_if_not_routed_or_dynamic_answer_options = true + @top_guidance_partial = "finding_location" end def answer_options diff --git a/app/views/form/guidance/_finding_location.erb b/app/views/form/guidance/_finding_location.erb new file mode 100644 index 000000000..4107519b3 --- /dev/null +++ b/app/views/form/guidance/_finding_location.erb @@ -0,0 +1,4 @@ +<%= govuk_details(summary_text: "What is a location?") do %> +
A location is a postcode where supported housing is provided under a scheme. A scheme can have multiple locations, and a location can have multiple units at the same postcode.
+<%= govuk_link_to("Read more about schemes and locations", scheme_changes_path) %>
+<% end %> diff --git a/spec/models/form/lettings/pages/location_spec.rb b/spec/models/form/lettings/pages/location_spec.rb index 659a4dd26..65bca4636 100644 --- a/spec/models/form/lettings/pages/location_spec.rb +++ b/spec/models/form/lettings/pages/location_spec.rb @@ -26,7 +26,7 @@ RSpec.describe Form::Lettings::Pages::Location, type: :model do end it "has the correct header" do - expect(page.header).to be_nil + expect(page.header).to eq("Location") end it "has the correct description" do diff --git a/spec/models/form/lettings/questions/location_id_spec.rb b/spec/models/form/lettings/questions/location_id_spec.rb index f31e16806..0d3f8d1c8 100644 --- a/spec/models/form/lettings/questions/location_id_spec.rb +++ b/spec/models/form/lettings/questions/location_id_spec.rb @@ -151,4 +151,15 @@ RSpec.describe Form::Lettings::Questions::LocationId, type: :model do expect(question.header).to eq("Which location is this letting for?") end end + + describe "partial guidance" do + it "shows shows correct top_guidance_partial" do + expect(question.top_guidance_partial).to eq("finding_location") + end + + it "is at the top" do + expect(question.top_guidance?).to eq(true) + expect(question.bottom_guidance?).to eq(false) + end + end end