Skip to content

Commit

Permalink
Merge pull request #4072 from alphagov/deduplicate-places-page-titles-2
Browse files Browse the repository at this point in the history
Fix duplicate page titles in places user journey
  • Loading branch information
hannalaakso committed May 21, 2024
2 parents b6c1ddf + b24664b commit 3295334
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/place_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def location_error
return LocationError.new(INVALID_POSTCODE) unless postcode_provided?
return LocationError.new(INVALID_POSTCODE) if places_manager_response.invalid_postcode?

LocationError.new(NO_LOCATION) if places_manager_response.places_not_found?
LocationError.new(NO_LOCATION) if places_manager_response.places_not_found? && !places_manager_response.addresses_returned?
end

def places_manager_response
Expand Down
4 changes: 4 additions & 0 deletions app/views/place/_place.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<%
content_for :title, "#{publication.title}: #{t('formats.local_transaction.search_result')} - GOV.UK"
%>
<% places.each do |place| %>
<li>
<div class="place group place-list__item">
Expand Down
2 changes: 2 additions & 0 deletions app/views/place/multiple_authorities.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<% content_for :title, "#{publication.title}: #{t('formats.local_transaction.select_address').downcase} - GOV.UK" %>
<%= render layout: "shared/base_page", locals: {
title: publication.title,
publication: publication,
Expand Down
8 changes: 8 additions & 0 deletions test/integration/place_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ class PlacesTest < ActionDispatch::IntegrationTest
assert_current_url "/passport-interview-office"
end

should "include the search result text in the page title" do
assert page.has_title?("Find a passport interview office: #{I18n.t('formats.local_transaction.search_result')} - GOV.UK", exact: true)
end

should "not display an error message" do
assert page.has_no_content?("Please enter a valid full UK postcode.")
end
Expand Down Expand Up @@ -329,6 +333,10 @@ class PlacesTest < ActionDispatch::IntegrationTest
click_on "Find"
end

should "include the select address text in the page title" do
assert page.has_title?("Find a passport interview office: #{I18n.t('formats.local_transaction.select_address').downcase} - GOV.UK", exact: true)
end

should "display the address chooser" do
assert page.has_content?("House 1")
end
Expand Down

0 comments on commit 3295334

Please sign in to comment.