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 SR from clear search button [OFN-12551] #12664

Merged
merged 2 commits into from
Jul 28, 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
177 changes: 0 additions & 177 deletions app/reflexes/products_reflex.rb

This file was deleted.

2 changes: 1 addition & 1 deletion app/views/admin/products_v3/_no_products.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- if search_term.present? || producer_id.present? || category_id.present?
= t('.no_products_found_for_search')
%a{ href: "#", class: "button disruptive relaxed", data: { reflex: "click->products#clear_search" } }
%a{ href: admin_products_path, class: "button disruptive relaxed", 'data-turbo-frame': "_self" }
= t("admin.products_v3.sort.pagination.clear_search")
- else
= t('.no_products_found')
Expand Down
22 changes: 22 additions & 0 deletions spec/system/admin/products_v3/index_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,28 @@
end
end

context "product has no searchble term" do
it 'clears search input with no results and returns products list' do
create_products 2
visit admin_products_url
expect(page).to have_field "search_term", with: ""
expect(page).to have_content "Showing 1 to 2"

# returns no results, if the product does not exist
search_for "a product which does not exist"

expect(page).to have_field "search_term", with: "a product which does not exist"
expect(page).to have_content "No products found for your search criteria"
expect_products_count_to_be 0

# clears search input and renders product list
click_link "Clear search"
expect(page).to have_content "2 products found for your search criteria. Showing 1 to 2."
expect(page).to have_field "search_term", with: ""
expect_products_count_to_be 2
end
end

context "product has producer" do
before { create_products 1 }

Expand Down
Loading