Browse Source

feat: update skip links (#2342)

pull/2328/head
natdeanlewissoftwire 9 months ago committed by GitHub
parent
commit
99ad80aebd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      app/models/form/lettings/pages/address_matcher.rb
  2. 6
      app/models/form/sales/pages/address_matcher.rb
  3. 7
      spec/models/form/lettings/pages/address_matcher_spec.rb
  4. 7
      spec/models/form/sales/pages/address_matcher_spec.rb

6
app/models/form/lettings/pages/address_matcher.rb

@ -20,4 +20,10 @@ class Form::Lettings::Pages::AddressMatcher < ::Form::Page
def submit_text def submit_text
"Search" "Search"
end end
def skip_href(log = nil)
return unless log
"/#{log.model_name.param_key.dasherize}s/#{log.id}/property-unit-type"
end
end end

6
app/models/form/sales/pages/address_matcher.rb

@ -20,4 +20,10 @@ class Form::Sales::Pages::AddressMatcher < ::Form::Page
def submit_text def submit_text
"Search" "Search"
end end
def skip_href(log = nil)
return unless log
"/#{log.model_name.param_key.dasherize}s/#{log.id}/property-number-of-bedrooms"
end
end end

7
spec/models/form/lettings/pages/address_matcher_spec.rb

@ -6,6 +6,7 @@ RSpec.describe Form::Lettings::Pages::AddressMatcher, type: :model do
let(:page_id) { nil } let(:page_id) { nil }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) } let(:subsection) { instance_double(Form::Subsection) }
let(:log) { create(:lettings_log) }
it "has correct subsection" do it "has correct subsection" do
expect(page.subsection).to eq(subsection) expect(page.subsection).to eq(subsection)
@ -30,4 +31,10 @@ RSpec.describe Form::Lettings::Pages::AddressMatcher, type: :model do
it "has correct depends_on" do it "has correct depends_on" do
expect(page.depends_on).to eq([{ "is_supported_housing?" => false, "uprn_known" => nil }, { "is_supported_housing?" => false, "uprn_known" => 0 }, { "is_supported_housing?" => false, "uprn_confirmed" => 0 }]) expect(page.depends_on).to eq([{ "is_supported_housing?" => false, "uprn_known" => nil }, { "is_supported_housing?" => false, "uprn_known" => 0 }, { "is_supported_housing?" => false, "uprn_confirmed" => 0 }])
end end
it "has the correct skip_href" do
expect(page.skip_href(log)).to eq(
"/lettings-logs/#{log.id}/property-unit-type",
)
end
end end

7
spec/models/form/sales/pages/address_matcher_spec.rb

@ -6,6 +6,7 @@ RSpec.describe Form::Sales::Pages::AddressMatcher, type: :model do
let(:page_id) { nil } let(:page_id) { nil }
let(:page_definition) { nil } let(:page_definition) { nil }
let(:subsection) { instance_double(Form::Subsection) } let(:subsection) { instance_double(Form::Subsection) }
let(:log) { create(:sales_log) }
it "has correct subsection" do it "has correct subsection" do
expect(page.subsection).to eq(subsection) expect(page.subsection).to eq(subsection)
@ -30,4 +31,10 @@ RSpec.describe Form::Sales::Pages::AddressMatcher, type: :model do
it "has correct depends_on" do it "has correct depends_on" do
expect(page.depends_on).to eq([{ "uprn_known" => nil }, { "uprn_known" => 0 }, { "uprn_confirmed" => 0 }]) expect(page.depends_on).to eq([{ "uprn_known" => nil }, { "uprn_known" => 0 }, { "uprn_confirmed" => 0 }])
end end
it "has the correct skip_href" do
expect(page.skip_href(log)).to eq(
"/sales-logs/#{log.id}/property-number-of-bedrooms",
)
end
end end

Loading…
Cancel
Save