From 66a106b1c94d101f7bc7d9016ac6a91facdc481b Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Tue, 15 Aug 2023 11:39:15 +0200 Subject: [PATCH] hide pagination for single page catalogue + update specs then --- app/views/admin/products_v3/_content.html.haml | 3 ++- spec/system/admin/products_v3/products_spec.rb | 5 ----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/views/admin/products_v3/_content.html.haml b/app/views/admin/products_v3/_content.html.haml index b598120c14..c9f33c55ef 100644 --- a/app/views/admin/products_v3/_content.html.haml +++ b/app/views/admin/products_v3/_content.html.haml @@ -11,7 +11,8 @@ .sixteen.columns = render partial: 'sort', locals: { pagy: pagy, search_term: search_term, producer_id: producer_id, category_id: category_id } = render partial: 'table', locals: { products: products } - = render partial: 'admin/shared/v3/pagy', locals: { pagy: pagy, reflex: "click->Products#fetch" } + - if pagy.pages > 1 + = render partial: 'admin/shared/v3/pagy', locals: { pagy: pagy, reflex: "click->Products#fetch" } - else #no-products = render partial: "no_products", locals: { search_term: search_term, producer_id: producer_id, category_id: category_id } diff --git a/spec/system/admin/products_v3/products_spec.rb b/spec/system/admin/products_v3/products_spec.rb index 1935200e6d..bddcfab8c1 100644 --- a/spec/system/admin/products_v3/products_spec.rb +++ b/spec/system/admin/products_v3/products_spec.rb @@ -73,7 +73,6 @@ describe 'As an admin, I can see the new product page' do search_for "searchable product" expect(page).to have_field "search_term", with: "searchable product" - expect_page_to_be 1 expect_products_count_to_be 1 end @@ -85,14 +84,12 @@ describe 'As an admin, I can see the new product page' do expect_per_page_to_be 15 expect_products_count_to_be 15 search_for "searchable product" - expect_page_to_be 1 expect_products_count_to_be 1 end it "can clear filters" do search_for "searchable product" expect(page).to have_field "search_term", with: "searchable product" - expect_page_to_be 1 expect_products_count_to_be 1 expect(page).to have_selector "table.products tbody tr td", text: product_by_name.name @@ -118,7 +115,6 @@ describe 'As an admin, I can see the new product page' do search_by_producer "Producer 1" expect(page).to have_select "producer_id", selected: "Producer 1" - expect_page_to_be 1 expect_products_count_to_be 1 end end @@ -133,7 +129,6 @@ describe 'As an admin, I can see the new product page' do search_by_category "Category 1" expect(page).to have_select "category_id", selected: "Category 1" - expect_page_to_be 1 expect_products_count_to_be 1 expect(page).to have_selector "table.products tbody tr td", text: product_by_category.name end