Browse Source

CLDC-3329: Update hint text for schemes question (#2336)

test-6-months-ago
Robert Sullivan 9 months ago committed by GitHub
parent
commit
976d0f6e73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 10
      app/models/form/lettings/questions/scheme_id.rb
  2. 31
      spec/models/form/lettings/questions/scheme_id_spec.rb

10
app/models/form/lettings/questions/scheme_id.rb

@ -3,7 +3,6 @@ class Form::Lettings::Questions::SchemeId < ::Form::Question
super("scheme_id", hsh, page) super("scheme_id", hsh, page)
@check_answer_label = "Scheme name" @check_answer_label = "Scheme name"
@header = "What scheme is this log for?" @header = "What scheme is this log for?"
@hint_text = "Enter postcode or scheme name"
@type = "select" @type = "select"
@answer_options = answer_options @answer_options = answer_options
@top_guidance_partial = "finding_scheme" @top_guidance_partial = "finding_scheme"
@ -49,6 +48,15 @@ class Form::Lettings::Questions::SchemeId < ::Form::Question
lettings_log.form.get_question("postcode_full", nil).label_from_value(lettings_log.postcode_full) unless lettings_log.scheme_has_multiple_locations? lettings_log.form.get_question("postcode_full", nil).label_from_value(lettings_log.postcode_full) unless lettings_log.scheme_has_multiple_locations?
end end
def hint_text
if form.start_year_after_2024?
"Enter postcode or scheme name.<br><br>
A supported housing scheme provides shared or self-contained housing for a particular client group, for example younger or vulnerable people."
else
"Enter postcode or scheme name"
end
end
private private
def supported_housing_selected?(lettings_log) def supported_housing_selected?(lettings_log)

31
spec/models/form/lettings/questions/scheme_id_spec.rb

@ -5,7 +5,15 @@ RSpec.describe Form::Lettings::Questions::SchemeId, type: :model do
let(:question_id) { nil } let(:question_id) { nil }
let(:question_definition) { nil } let(:question_definition) { nil }
let(:page) { instance_double(Form::Page, subsection: instance_double(Form::Subsection, form: instance_double(Form, start_date: Time.zone.local(2023, 4, 1)))) } let(:page) { instance_double(Form::Page) }
let(:subsection) { instance_double(Form::Subsection) }
let(:form) { instance_double(Form, start_date: Time.zone.local(2023, 4, 1)) }
before do
allow(page).to receive(:subsection).and_return(subsection)
allow(subsection).to receive(:form).and_return(form)
allow(form).to receive(:start_year_after_2024?).and_return(false)
end
it "has correct page" do it "has correct page" do
expect(question.page).to eq(page) expect(question.page).to eq(page)
@ -27,8 +35,25 @@ RSpec.describe Form::Lettings::Questions::SchemeId, type: :model do
expect(question.type).to eq("select") expect(question.type).to eq("select")
end end
it "has the correct hint_text" do context "when 2023" do
expect(question.hint_text).to eq("Enter postcode or scheme name") before do
allow(form).to receive(:start_year_after_2024?).and_return(false)
end
it "has the correct hint_text" do
expect(question.hint_text).to eq("Enter postcode or scheme name")
end
end
context "when 2024" do
before do
allow(form).to receive(:start_year_after_2024?).and_return(true)
end
it "has the correct hint_text" do
expect(question.hint_text).to eq("Enter postcode or scheme name.<br><br>
A supported housing scheme provides shared or self-contained housing for a particular client group, for example younger or vulnerable people.")
end
end end
it "has the correct conditional_for" do it "has the correct conditional_for" do

Loading…
Cancel
Save