From c5bb2f52e14dffe6d84533a6de2cb81d4b752155 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Tue, 19 Jul 2022 13:05:47 +1000 Subject: [PATCH] Check "Select all" to start with Reflect the state of the shipping method checkboxes. --- app/views/admin/order_cycles/checkout_options.html.haml | 2 +- .../admin/order_cycles/complex_creating_specific_time_spec.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/views/admin/order_cycles/checkout_options.html.haml b/app/views/admin/order_cycles/checkout_options.html.haml index d95b231187..345f950ab2 100644 --- a/app/views/admin/order_cycles/checkout_options.html.haml +++ b/app/views/admin/order_cycles/checkout_options.html.haml @@ -26,7 +26,7 @@ %tr{ "data-controller": "select-all" } %td.text-center %label - = check_box_tag "bla", nil, shipping_methods == @order_cycle.shipping_methods, { "data-action": "change->select-all#toggleAll", "data-select-all-target": "all" } + = check_box_tag "bla", nil, (shipping_methods - @order_cycle.shipping_methods).empty?, { "data-action": "change->select-all#toggleAll", "data-select-all-target": "all" } = "Select all" %td - if shipping_methods.any? diff --git a/spec/system/admin/order_cycles/complex_creating_specific_time_spec.rb b/spec/system/admin/order_cycles/complex_creating_specific_time_spec.rb index f70bbb7d61..3b9942890d 100644 --- a/spec/system/admin/order_cycles/complex_creating_specific_time_spec.rb +++ b/spec/system/admin/order_cycles/complex_creating_specific_time_spec.rb @@ -158,11 +158,15 @@ describe ' end def select_shipping_methods + expect(page).to have_checked_field "Select all" + expect(page).to have_checked_field "Pickup - always available" expect(page).to have_checked_field "Delivery - sometimes available" uncheck "Delivery - sometimes available" + expect(page).to have_unchecked_field "Select all" + click_button 'Save and Back to List' end