Browse Source

CLDC-2630 Location fixes (#1870)

* Display question unanswered for empty strings

* Fix back button for local authority

* Update test name

Co-authored-by: natdeanlewissoftwire <94526761+natdeanlewissoftwire@users.noreply.github.com>

---------

Co-authored-by: natdeanlewissoftwire <94526761+natdeanlewissoftwire@users.noreply.github.com>
pull/1876/head
kosiakkatrina 1 year ago committed by GitHub
parent
commit
084dfb4dab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      app/helpers/details_table_helper.rb
  2. 2
      app/views/locations/local_authority.html.erb
  3. 7
      spec/features/schemes_spec.rb

4
app/helpers/details_table_helper.rb

@ -4,7 +4,9 @@ module DetailsTableHelper
list = attribute[:value].map { |value| "<li>#{value}</li>" }.join list = attribute[:value].map { |value| "<li>#{value}</li>" }.join
simple_format(list, { class: "govuk-list govuk-list--bullet" }, wrapper_tag: "ul") simple_format(list, { class: "govuk-list govuk-list--bullet" }, wrapper_tag: "ul")
else else
value = attribute[:value].is_a?(Array) ? attribute[:value].first : attribute[:value] || "<span class=\"app-!-colour-muted\">You didn’t answer this question</span>".html_safe return simple_format(attribute[:value].first.to_s, { class: "govuk-body" }, wrapper_tag: "p") if attribute[:value].is_a?(Array)
value = attribute[:value].presence || "<span class=\"app-!-colour-muted\">You didn’t answer this question</span>".html_safe
simple_format(value.to_s, { class: "govuk-body" }, wrapper_tag: "p") simple_format(value.to_s, { class: "govuk-body" }, wrapper_tag: "p")
end end

2
app/views/locations/local_authority.html.erb

@ -3,7 +3,7 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
href: case params[:referrer] href: case params[:referrer]
when "check_local_authority" when "check_local_authority", "check_answers"
scheme_location_check_answers_path(@scheme, @location, route: params[:route]) scheme_location_check_answers_path(@scheme, @location, route: params[:route])
else else
scheme_location_postcode_path(@scheme, @location, route: params[:route], referrer: params[:referrer]) scheme_location_postcode_path(@scheme, @location, route: params[:route], referrer: params[:referrer])

7
spec/features/schemes_spec.rb

@ -552,6 +552,13 @@ RSpec.describe "Schemes scheme Features" do
fill_in_and_save_second_location fill_in_and_save_second_location
expect(page).to have_content "Check your answers" expect(page).to have_content "Check your answers"
end end
it "dispays correct text for unanswered questions" do
fill_in_and_save_location
location.update!(location_code: nil)
visit "/schemes/#{scheme.id}/locations/#{location.id}/check-answers"
expect(page).to have_content "You didn’t answer this question"
end
end end
context "when viewing locations" do context "when viewing locations" do

Loading…
Cancel
Save