mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Fix Ship Order menu choice not working
- Front End ShipOrderComponent was missed for the menu to work - updated spec to test for a specific case
This commit is contained in:
committed by
Sigmund Petersen
parent
907b154108
commit
901c29c97b
@@ -6,8 +6,10 @@
|
||||
%i.icon-check
|
||||
= I18n.t 'admin.actions'
|
||||
%div.menu{"data-action": "click->dropdown#closeOnMenu"}
|
||||
- shipment_ready = false
|
||||
- order_links(@order).each do |link|
|
||||
- if link[:name] == t(:ship_order)
|
||||
- shipment_ready = true
|
||||
%a.menu_item{ href: link[:url], target: link[:target] || "_self", data: { "modal-link-target-value": dom_id(@order, :ship), "action": "click->modal-link#open", "controller": "modal-link" } }
|
||||
%span
|
||||
%i{ class: link[:icon] }
|
||||
@@ -19,3 +21,6 @@
|
||||
%span=link[:name]
|
||||
|
||||
= render 'spree/admin/shared/custom-confirm'
|
||||
- if shipment_ready
|
||||
%form
|
||||
= render ShipOrderComponent.new(order: @order)
|
||||
|
||||
@@ -1006,6 +1006,30 @@ describe '
|
||||
it_behaves_like "ship order from dropdown", "Invoices"
|
||||
it_behaves_like "ship order from dropdown", "Return Authorizations"
|
||||
end
|
||||
|
||||
context 'when not on the Order Details sub section' do
|
||||
before do
|
||||
click_link 'Customer Details'
|
||||
end
|
||||
it 'can ship order too' do
|
||||
find('.ofn-drop-down').click
|
||||
click_link 'Ship Order'
|
||||
|
||||
within ".reveal-modal" do
|
||||
expect(page).to have_checked_field('Send a shipment/pick up ' \
|
||||
'notification email to the customer.')
|
||||
# no test of enqueued job since it can cause failures
|
||||
# if the remainder of the spec is too fasr
|
||||
find_button('Confirm').click
|
||||
end
|
||||
|
||||
# the best & easiest way to close the modal without calling all the JS
|
||||
find_button("Cancel").click
|
||||
expect(order.reload.shipped?).to be true
|
||||
click_link('Order Details')
|
||||
expect(page).to have_text 'SHIPPED'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "when an included variant has been deleted" do
|
||||
|
||||
Reference in New Issue
Block a user