Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate page titles in places user journey #4072

Merged
merged 4 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks okay as a fix.

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