mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-27 06:05:19 +00:00
Sort products by name in ascending order
The order is specified above in fetch_products. I'm guessing this line was unintentional? Original requirment doesn't say ascending but I think it's safe to assume (issue#10694).
This commit is contained in:
committed by
Jean-Baptiste Bellet
parent
6dbfb36e52
commit
e816228959
@@ -96,7 +96,7 @@ class ProductsReflex < ApplicationReflex
|
||||
end
|
||||
|
||||
def ransack_query
|
||||
query = { s: "name desc" }
|
||||
query = {}
|
||||
query.merge!(supplier_id_in: @producer_id) if @producer_id.present?
|
||||
if @search_term.present?
|
||||
query.merge!(Spree::Variant::SEARCH_KEY => @search_term)
|
||||
|
||||
@@ -23,6 +23,21 @@ describe 'As an admin, I can see the new product page' do
|
||||
expect(page).to have_content "Bulk Edit Products"
|
||||
end
|
||||
|
||||
describe "sorting" do
|
||||
let!(:product_z) { create(:simple_product, name: "Zucchini") }
|
||||
let!(:product_a) { create(:simple_product, name: "Apples") }
|
||||
|
||||
before do
|
||||
visit admin_products_v3_index_url
|
||||
end
|
||||
|
||||
it "Should sort products alphabetically by default" do
|
||||
expect(page).to have_selector "table.products tbody tr td", text: "Apples"
|
||||
# other products push later one to next page
|
||||
expect(page).not_to have_selector "table.products tbody tr td", text: "Zucchini"
|
||||
end
|
||||
end
|
||||
|
||||
describe "pagination" do
|
||||
before do
|
||||
visit admin_products_v3_index_url
|
||||
|
||||
Reference in New Issue
Block a user