Display checkbox that "save as default address"

This commit is contained in:
Jean-Baptiste Bellet
2022-03-11 12:11:14 +01:00
parent 483ec42328
commit bcf6c7984e
2 changed files with 3 additions and 1 deletions

View File

@@ -142,7 +142,7 @@
= ship_address.select :state_id, states_for_country(ship_address_country), { selected: @order.ship_address&.state_id }, { "data-dependant-select-target": "select" }
- if spree_current_user
%div.checkout-input{ "data-toggle-target": "content", style: "display: none" }
%div.checkout-input{ "data-toggle-target": "content", style: "display: #{display_ship_address ? 'block' : 'none'}" }
= f.check_box :save_ship_address
= f.label :save_ship_address, t(:checkout_default_ship_address)

View File

@@ -198,11 +198,13 @@ describe "As a consumer, I want to checkout my order", js: true do
it "display the checkbox about shipping address same as billing address when selecting a shipping method that requires ship address" do
choose free_shipping_with_required_address.name
check "Shipping address same as billing address?"
expect(page).to have_content "Save as default shipping address"
click_button "Next - Payment method"
expect(page).to have_content "Saving failed, please update the highlighted fields."
expect(page).to have_content "Shipping address same as billing address?"
expect(page).to have_content "Save as default shipping address"
expect(page).to have_checked_field "Shipping address same as billing address?"
end
end