From bcf6c7984e30dc20412ae5adc085100acefb9ee9 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Fri, 11 Mar 2022 12:11:14 +0100 Subject: [PATCH] Display checkbox that "save as default address" --- app/views/split_checkout/_details.html.haml | 2 +- spec/system/consumer/split_checkout_spec.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/app/views/split_checkout/_details.html.haml b/app/views/split_checkout/_details.html.haml index d7c7cdbda5..a6d7e3f311 100644 --- a/app/views/split_checkout/_details.html.haml +++ b/app/views/split_checkout/_details.html.haml @@ -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) diff --git a/spec/system/consumer/split_checkout_spec.rb b/spec/system/consumer/split_checkout_spec.rb index be816b5ae3..9bbe9b0593 100644 --- a/spec/system/consumer/split_checkout_spec.rb +++ b/spec/system/consumer/split_checkout_spec.rb @@ -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