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

Remove "disable autocomplete" feature flag #3624

Merged
merged 1 commit into from
Jan 10, 2025
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
6 changes: 0 additions & 6 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,4 @@ module ApplicationHelper
def absolute_url_for(path)
URI.join(Plek.new.website_root, path)
end

def search_component
use_autocomplete = true unless ENV["GOVUK_DISABLE_SEARCH_AUTOCOMPLETE"]

use_autocomplete ? "search_with_autocomplete" : "search"
end
end
2 changes: 1 addition & 1 deletion app/views/finders/show_all_content_finder.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds-from-desktop">
<div id="keywords" role="search" aria-label="Sitewide">
<%= render "govuk_publishing_components/components/#{search_component}", {
<%= render "govuk_publishing_components/components/search_with_autocomplete", {
id: "finder-keyword-search",
name: "keywords",
type: 'search',
Expand Down
2 changes: 1 addition & 1 deletion app/views/search/_search_field.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
} %>
<% end %>

<%= render "govuk_publishing_components/components/#{search_component}", {
<%= render "govuk_publishing_components/components/search_with_autocomplete", {
inline_label: false,
label_text: label_text,
size: "large",
Expand Down
19 changes: 0 additions & 19 deletions spec/controllers/finders_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,25 +251,6 @@
expect(response.status).to eq(200)
expect(response).to render_template("finders/show_all_content_finder")
end

describe "search autocomplete" do
it "renders the search autocomplete when enabled" do
ClimateControl.modify GOVUK_DISABLE_SEARCH_AUTOCOMPLETE: nil do
get :show, params: { slug: "search/all", keywords: "hello" }

expect(response.body).to include("gem-c-search-with-autocomplete")
end
end

it "does not render the autocomplete when disabled" do
ClimateControl.modify GOVUK_DISABLE_SEARCH_AUTOCOMPLETE: "1" do
get :show, params: { slug: "search/all", keywords: "hello" }

expect(response.body).not_to include("gem-c-search-with-autocomplete")
expect(response.body).to include("gem-c-search")
end
end
end
end
end

Expand Down
21 changes: 0 additions & 21 deletions spec/controllers/search_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,5 @@
expect(response).to redirect_to(destination)
end
end

context "when GOVUK_DISABLE_SEARCH_AUTOCOMPLETE is not set" do
it "renders the search autocomplete component" do
ClimateControl.modify GOVUK_DISABLE_SEARCH_AUTOCOMPLETE: nil do
get :index

expect(response.body).to include("gem-c-search-with-autocomplete")
end
end
end

context "when GOVUK_DISABLE_SEARCH_AUTOCOMPLETE is set" do
it "renders the search component instead of the autocomplete component" do
ClimateControl.modify GOVUK_DISABLE_SEARCH_AUTOCOMPLETE: "1" do
get :index

expect(response.body).not_to include("gem-c-search-with-autocomplete")
expect(response.body).to include("gem-c-search")
end
end
end
end
end
21 changes: 0 additions & 21 deletions spec/helpers/application_helper_spec.rb

This file was deleted.

Loading