From 620dd70dd7e6cbe3145e96a21d6eea4297e6289e Mon Sep 17 00:00:00 2001 From: Mohamed ABDELLANI Date: Tue, 8 Aug 2023 09:30:15 +0100 Subject: [PATCH] rename 'new invoice' button to 'create or update invoice' --- app/views/spree/admin/invoices/index.html.haml | 2 +- config/locales/en.yml | 2 +- spec/system/admin/order_spec.rb | 6 +++--- spec/system/admin/orders/invoices_spec.rb | 14 +++++++------- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/views/spree/admin/invoices/index.html.haml b/app/views/spree/admin/invoices/index.html.haml index df49cc615b..c97e7bed1b 100644 --- a/app/views/spree/admin/invoices/index.html.haml +++ b/app/views/spree/admin/invoices/index.html.haml @@ -7,7 +7,7 @@ - content_for :page_actions do - if show_generate_invoice_button?(@order) - %li= button_link_to t(:new_invoice), generate_admin_order_invoices_path(@order), :icon => 'icon-plus', data: { method: 'post' } + %li= button_link_to t(:create_or_update_invoice), generate_admin_order_invoices_path(@order), :icon => 'icon-plus', data: { method: 'post' } = render partial: 'spree/admin/shared/order_links' %li= button_link_to t(:back_to_orders_list), admin_orders_path, :icon => 'icon-arrow-left' diff --git a/config/locales/en.yml b/config/locales/en.yml index bcf99fc388..58f7fa8564 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3165,7 +3165,7 @@ See the %{link} to find out more about %{sitename}'s features and to start using no_orders_found: "No Orders Found" order_information: "Order Information" new_payment: "New Payment" - new_invoice: "New Invoice" + create_or_update_invoice: "Create or Update Invoice" date_completed: "Date Completed" amount: "Amount" invoice_number: "Invoice Number" diff --git a/spec/system/admin/order_spec.rb b/spec/system/admin/order_spec.rb index 81727b48ee..d4f0b93212 100644 --- a/spec/system/admin/order_spec.rb +++ b/spec/system/admin/order_spec.rb @@ -1066,11 +1066,11 @@ describe ' expect(page.find("table").text).to have_content(table_header) # the New invoice button should be visible - expect(page).to have_link "New Invoice" - click_link 'New Invoice' + expect(page).to have_link "Create or Update Invoice" + click_link "Create or Update Invoice" # and disappear after clicking - expect(page).to have_no_link "New Invoice" + expect(page).to have_no_link "Create or Update Invoice" # creating an invoice, displays a second row expect(page.find("table").text).to have_content(table_contents) diff --git a/spec/system/admin/orders/invoices_spec.rb b/spec/system/admin/orders/invoices_spec.rb index 26b8644a6b..311c6c8d53 100644 --- a/spec/system/admin/orders/invoices_spec.rb +++ b/spec/system/admin/orders/invoices_spec.rb @@ -38,8 +38,8 @@ describe ' click_link 'Invoices' expect { - click_link 'New Invoice' - expect(page).to have_no_link "New Invoice" + click_link "Create or Update Invoice" + expect(page).to have_no_link "Create or Update Invoice" }.to change { order.invoices.count }.by(1) invoice = order.invoices.first @@ -54,7 +54,7 @@ describe ' context 'order not updated since latest invoice' do it 'should not render new invoice button' do click_link 'Invoices' - expect(page).to_not have_link 'New Invoice' + expect(page).to_not have_link "Create or Update Invoice" end end @@ -70,8 +70,8 @@ describe ' it 'updates the lastest invoice for the order' do click_link 'Invoices' expect { - click_link 'New Invoice' - expect(page).to have_no_link "New Invoice" + click_link "Create or Update Invoice" + expect(page).to have_no_link "Create or Update Invoice" }.to change { order.reload.invoices.count }.by(0) .and change { latest_invoice.reload.presenter.note }.from("").to(new_note) @@ -87,8 +87,8 @@ describe ' it 'creates a new invoice for the order' do click_link 'Invoices' expect { - click_link 'New Invoice' - expect(page).to have_no_link "New Invoice" + click_link "Create or Update Invoice" + expect(page).to have_no_link "Create or Update Invoice" }.to change { order.reload.invoices.count }.by(1) expect(latest_invoice.reload.cancelled).to eq true