Browse Source

Extract housing needs soft validations copy

pull/2718/head
Kat 2 years ago
parent
commit
1516459ca6
  1. 4
      app/models/form/sales/pages/household_wheelchair_check.rb
  2. 3
      app/models/form/sales/questions/household_wheelchair_check.rb
  3. 2
      config/locales/en.yml
  4. 6
      config/locales/forms/2023/sales/soft_validations.en.yml
  5. 6
      config/locales/forms/2024/sales/soft_validations.en.yml
  6. 3
      spec/models/form/sales/pages/household_wheelchair_check_spec.rb
  7. 3
      spec/models/form/sales/subsections/household_needs_spec.rb

4
app/models/form/sales/pages/household_wheelchair_check.rb

@ -6,8 +6,8 @@ class Form::Sales::Pages::HouseholdWheelchairCheck < ::Form::Page
"wheelchair_when_not_disabled?" => true, "wheelchair_when_not_disabled?" => true,
}, },
] ]
@informative_text = {} @copy_key = "sales.soft_validations.wheel_value_check"
@title_text = { "translation" => "soft_validations.wheelchair.title_text" } @title_text = { "translation" => "forms.#{form.start_date.year}.#{@copy_key}.title_text" }
end end
def questions def questions

3
app/models/form/sales/questions/household_wheelchair_check.rb

@ -2,8 +2,7 @@ class Form::Sales::Questions::HouseholdWheelchairCheck < ::Form::Question
def initialize(id, hsh, page) def initialize(id, hsh, page)
super super
@id = "wheel_value_check" @id = "wheel_value_check"
@check_answer_label = "Does anyone in the household use a wheelchair?" @copy_key = "sales.soft_validations.wheel_value_check"
@header = "You told us that someone in the household uses a wheelchair."
@type = "interruption_screen" @type = "interruption_screen"
@answer_options = { @answer_options = {
"0" => { "value" => "Yes" }, "0" => { "value" => "Yes" },

2
config/locales/en.yml

@ -768,8 +768,6 @@ Make sure these answers are correct."
grant: grant:
title_text: "You told us that the grant amount is %{grant}." title_text: "You told us that the grant amount is %{grant}."
hint_text: "Loans, grants and subsidies are usually between £9,000 and £16,000." hint_text: "Loans, grants and subsidies are usually between £9,000 and £16,000."
wheelchair:
title_text: "You told us that someone in the household uses a wheelchair."
referral: referral:
title_text: "Are you sure?" title_text: "Are you sure?"
hint_text: "This is a general needs log, and this referral type is for supported housing." hint_text: "This is a general needs log, and this referral type is for supported housing."

6
config/locales/forms/2023/sales/soft_validations.en.yml

@ -58,3 +58,9 @@ en:
not_joint_purchase: not_joint_purchase:
title_text: "You told us the buyer’s deposit was %{deposit} and their savings were %{savings}." title_text: "You told us the buyer’s deposit was %{deposit} and their savings were %{savings}."
informative_text: "The deposit amount is higher than we would expect for the amount of savings they have." informative_text: "The deposit amount is higher than we would expect for the amount of savings they have."
wheel_value_check:
page_header: ""
check_answer_label: "Does anyone in the household use a wheelchair?"
hint_text: ""
question_text: "You told us that someone in the household uses a wheelchair."
title_text: "You told us that someone in the household uses a wheelchair."

6
config/locales/forms/2024/sales/soft_validations.en.yml

@ -58,3 +58,9 @@ en:
not_joint_purchase: not_joint_purchase:
title_text: "You told us the buyer’s deposit was %{deposit} and their savings were %{savings}." title_text: "You told us the buyer’s deposit was %{deposit} and their savings were %{savings}."
informative_text: "The deposit amount is higher than we would expect for the amount of savings they have." informative_text: "The deposit amount is higher than we would expect for the amount of savings they have."
wheel_value_check:
page_header: ""
check_answer_label: "Does anyone in the household use a wheelchair?"
hint_text: ""
question_text: "You told us that someone in the household uses a wheelchair."
title_text: "You told us that someone in the household uses a wheelchair."

3
spec/models/form/sales/pages/household_wheelchair_check_spec.rb

@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Pages::HouseholdWheelchairCheck, type: :model do
let(:page_id) { "buyer_1_income_mortgage_value_check" } let(:page_id) { "buyer_1_income_mortgage_value_check" }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) } let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) }
let(:subsection) { instance_double(Form::Subsection, form:) }
it "has correct subsection" do it "has correct subsection" do
expect(page.subsection).to eq(subsection) expect(page.subsection).to eq(subsection)

3
spec/models/form/sales/subsections/household_needs_spec.rb

@ -5,7 +5,8 @@ RSpec.describe Form::Sales::Subsections::HouseholdNeeds, type: :model do
let(:subsection_id) { nil } let(:subsection_id) { nil }
let(:subsection_definition) { nil } let(:subsection_definition) { nil }
let(:section) { instance_double(Form::Sales::Sections::Household) } let(:form) { instance_double(Form, start_date: Time.zone.local(2024, 4, 1)) }
let(:section) { instance_double(Form::Sales::Sections::Household, form:) }
it "has correct section" do it "has correct section" do
expect(household_characteristics.section).to eq(section) expect(household_characteristics.section).to eq(section)

Loading…
Cancel
Save