Check "Select all" to start with

Reflect the state of the shipping method checkboxes.
This commit is contained in:
Maikel Linke
2022-07-19 13:05:47 +10:00
committed by Filipe
parent 758030e81a
commit c5bb2f52e1
2 changed files with 5 additions and 1 deletions

View File

@@ -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?

View File

@@ -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