Delete selected line items even if does not lead to order cancellation

This commit is contained in:
Jean-Baptiste Bellet
2023-02-15 11:49:53 +01:00
parent cf8d9c6d07
commit e5ca8b0ee1
2 changed files with 19 additions and 0 deletions

View File

@@ -150,6 +150,8 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
else
Promise.all(LineItems.delete(item) for item in items).then(-> $scope.refreshData())
, "js.admin.deleting_item_will_cancel_order")
else
Promise.all(LineItems.delete(item) for item in lineItemsToDelete).then(-> $scope.refreshData())
$scope.allBoxesChecked = ->
checkedCount = $scope.filteredLineItems.reduce (count,lineItem) ->

View File

@@ -784,6 +784,23 @@ describe '
expect(o2.reload.state).to eq("complete")
end.to have_enqueued_mail(Spree::OrderMailer, :cancel_email)
end
it "deletes one line item and do not show any popup if it does not lead to order cancelation" do
expect(page).to have_selector "tr#li_#{li1.id}"
within("tr#li_#{li1.id} td.bulk") do
check "bulk"
end
find("div#bulk-actions-dropdown").click
find("div#bulk-actions-dropdown div.menu_item", text: "Delete Selected" ).click
expect(page).to have_content "Loading orders"
expect(page).to have_no_selector ".modal"
expect(page).to have_no_selector "tr#li_#{li1.id}"
expect(page).to have_selector "tr#li_#{li11.id}"
expect(o1.reload.state).to eq("complete")
end
end
end