From 8fe0a82b7548b83f39150607615915a7a45128ec Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Fri, 20 Aug 2021 15:18:09 +0200 Subject: [PATCH] Change ng-click to ng-change to capture ng-model updated value - Create a feature test for this feature --- app/views/spree/admin/orders/index.html.haml | 2 +- spec/features/admin/orders_spec.rb | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/views/spree/admin/orders/index.html.haml b/app/views/spree/admin/orders/index.html.haml index 08899c50d0..d06562fd2a 100644 --- a/app/views/spree/admin/orders/index.html.haml +++ b/app/views/spree/admin/orders/index.html.haml @@ -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 diff --git a/spec/features/admin/orders_spec.rb b/spec/features/admin/orders_spec.rb index c777d6e548..fa4757a424 100644 --- a/spec/features/admin/orders_spec.rb +++ b/spec/features/admin/orders_spec.rb @@ -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