From f0b12fbe105cd63c1745710b2cdf535d28a2a902 Mon Sep 17 00:00:00 2001 From: Chris Todorov Date: Thu, 11 Apr 2024 15:30:57 -0700 Subject: [PATCH] Show the page action for creating a new shipping method It would be helpful to be able to add shipping methods in the new admin, even though the new views are not migrated yet. This change renames the actions method to page_actions to get that. Co-authored-by: Harmony Bouvier --- .../solidus_admin/shipping_methods/index/component.rb | 2 +- admin/spec/features/shipping_methods_spec.rb | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/admin/app/components/solidus_admin/shipping_methods/index/component.rb b/admin/app/components/solidus_admin/shipping_methods/index/component.rb index 77624e1f8ca..69a3f3fbe3f 100644 --- a/admin/app/components/solidus_admin/shipping_methods/index/component.rb +++ b/admin/app/components/solidus_admin/shipping_methods/index/component.rb @@ -17,7 +17,7 @@ def search_key :name_or_description_cont end - def actions + def page_actions render component("ui/button").new( tag: :a, text: t('.add'), diff --git a/admin/spec/features/shipping_methods_spec.rb b/admin/spec/features/shipping_methods_spec.rb index 3e85df71926..371d9424c29 100644 --- a/admin/spec/features/shipping_methods_spec.rb +++ b/admin/spec/features/shipping_methods_spec.rb @@ -5,7 +5,7 @@ describe "Shipping Methods", :js, type: :feature do before { sign_in create(:admin_user, email: 'admin@example.com') } - it "lists tax categories and allows deleting them" do + it "lists shipping methods and allows deleting them" do create(:shipping_method, name: "FAAAST") visit "/admin/shipping_methods" @@ -14,9 +14,17 @@ select_row("FAAAST") click_on "Delete" + expect(page).to have_content("Shipping methods were successfully removed.") expect(page).not_to have_content("FAAAST") expect(Spree::ShippingMethod.count).to eq(0) expect(page).to be_axe_clean end + + it "shows the link for creating a new shipping method" do + visit "/admin/shipping_methods" + + expect(page).to have_content("Add new") + expect(page).to have_selector(:css, 'a[href="/admin/shipping_methods/new"]') + end end