mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-02 21:57:17 +00:00
Fix Ship Order Button: modal should close itself
- returns to the same processing for customer, invoices etc. that edit - need a bit of sleep in spec bc 2 tasks are asynchroneous
This commit is contained in:
committed by
Sigmund Petersen
parent
34bb05e681
commit
271d50e5ab
@@ -21,7 +21,7 @@ module Admin
|
||||
def ship
|
||||
@order.send_shipment_email = false unless params[:send_shipment_email]
|
||||
if @order.ship
|
||||
return set_param_for_controller if request.url.match?('edit')
|
||||
return set_param_for_controller if Regexp.union(Constants::PATHS).match? request.url
|
||||
|
||||
morph dom_id(@order), render(partial: "spree/admin/orders/table_row",
|
||||
locals: { order: @order.reload, success: true })
|
||||
@@ -134,4 +134,8 @@ module Admin
|
||||
morph_admin_flashes
|
||||
end
|
||||
end
|
||||
|
||||
module Constants
|
||||
PATHS = %w[edit customer payments adjustments invoices return_authorizations].freeze
|
||||
end
|
||||
end
|
||||
|
||||
@@ -971,10 +971,10 @@ describe '
|
||||
find_button("Confirm").click
|
||||
end
|
||||
|
||||
find_button("Cancel").click # closes modal as it is not automatic
|
||||
expect(page).to have_selector('.reveal-modal', visible: false)
|
||||
click_link('Order Details') unless subpage == 'Order Details'
|
||||
|
||||
sleep(0.5) # avoid flakyness
|
||||
expect(order.reload.shipped?).to be true
|
||||
expect(page).to have_text 'SHIPPED'
|
||||
expect(ActionMailer::MailDeliveryJob).to have_been_enqueued
|
||||
@@ -995,9 +995,10 @@ describe '
|
||||
find_button("Confirm").click
|
||||
end
|
||||
|
||||
find_button("Cancel").click # closes modal as it is not automatic
|
||||
expect(page).to have_selector('.reveal-modal', visible: false)
|
||||
click_link('Order Details') unless subpage == 'Order Details'
|
||||
|
||||
sleep(0.5) # avoir flakyness
|
||||
expect(order.reload.shipped?).to be true
|
||||
expect(page).to have_text 'SHIPPED'
|
||||
expect(ActionMailer::MailDeliveryJob).not_to have_been_enqueued
|
||||
|
||||
Reference in New Issue
Block a user