Merge pull request #8088 from jibees/8087-select-unselect-orders-in-admin

Handle select/unselect all orders in the admin orders page
This commit is contained in:
Andy Brett
2021-08-28 11:34:20 -07:00
committed by GitHub
2 changed files with 20 additions and 1 deletions

View File

@@ -32,7 +32,7 @@
%thead
%tr
%th
%input{type: 'checkbox', 'ng-click' => 'toggleAll()', 'ng-model' => 'select_all'}
%input{type: 'checkbox', 'ng-change' => 'toggleAll()', 'ng-model' => 'select_all'}
%th
= t(:products_distributor)
%th

View File

@@ -62,6 +62,25 @@ feature '
expect(page).to_not have_content order4.number
end
context "select/unselect all orders" do
scenario "by clicking on the checkbox in the table header" do
order2 = create(:order_with_credit_payment, user: user, distributor: distributor,
order_cycle: order_cycle)
order3 = create(:order_with_credit_payment, user: user, distributor: distributor,
order_cycle: order_cycle)
order4 = create(:order_with_credit_payment, user: user, distributor: distributor,
order_cycle: order_cycle)
login_as_admin_and_visit spree.admin_orders_path
# select all orders
page.find("#listing_orders thead th:first-child input[type=checkbox]").click
expect(page.find("#listing_orders tbody tr td:first-child input[type=checkbox]")).to be_checked
# unselect all orders
page.find("#listing_orders thead th:first-child input[type=checkbox]").click
expect(page.find("#listing_orders tbody tr td:first-child input[type=checkbox]")).to_not be_checked
end
end
context "with a capturable order" do
before do
order.finalize! # ensure order has a payment to capture