Skip to content

Commit

Permalink
Merge pull request #4569 from alphagov/remove-ff
Browse files Browse the repository at this point in the history
Remove "disable autocomplete" feature flag
  • Loading branch information
csutter authored Jan 10, 2025
2 parents cdd8c58 + 2902866 commit da60a30
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 40 deletions.
15 changes: 0 additions & 15 deletions app/controllers/homepage_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,4 @@ class HomepageController < ContentItemsController
def index
set_slimmer_headers(template: "gem_layout_homepage_new")
end

private

def search_component
if show_search_autocomplete?
"search_with_autocomplete"
else
"search"
end
end
helper_method :search_component

def show_search_autocomplete?
true unless ENV["GOVUK_DISABLE_SEARCH_AUTOCOMPLETE"]
end
end
2 changes: 1 addition & 1 deletion app/views/homepage/_homepage_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
ga4_search_index_section_count: 6,
}
) do %>
<%= render "govuk_publishing_components/components/#{search_component}", {
<%= render "govuk_publishing_components/components/search_with_autocomplete", {
name: "keywords",
button_text: t("homepage.index.search_button"),
margin_bottom: 0,
Expand Down
24 changes: 0 additions & 24 deletions spec/system/homepage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,6 @@
expect(page).to have_content("Some popular links title")
end

describe "search autocomplete" do
context "when autocomplete is enabled" do
it "renders the search with autocomplete component with the correct source URL" do
ClimateControl.modify GOVUK_DISABLE_SEARCH_AUTOCOMPLETE: nil do
visit "/"

expect(page).to have_css(".gem-c-search-with-autocomplete")
expect(page).to have_css("[data-source-url='http://www.dev.gov.uk/api/search/autocomplete.json']")
end
end
end

context "when autocomplete is disabled" do
it "does not render the search with autocomplete component" do
ClimateControl.modify GOVUK_DISABLE_SEARCH_AUTOCOMPLETE: "1" do
visit "/"

expect(page).not_to have_css(".gem-c-search-with-autocomplete")
expect(page).to have_css(".gem-c-search")
end
end
end
end

context "when visiting a Welsh content item first" do
before do
@payload = {
Expand Down

0 comments on commit da60a30

Please sign in to comment.