mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-09 23:06:06 +00:00
Automatically copy shipping address from billing if none present
This commit is contained in:
@@ -53,6 +53,7 @@ angular.module("admin.standingOrders").controller "StandingOrderController", ($s
|
||||
delete response.ship_address.id
|
||||
angular.extend($scope.standingOrder.bill_address, response.bill_address)
|
||||
angular.extend($scope.standingOrder.ship_address, response.ship_address)
|
||||
$scope.shipAddressFromBilling() unless response.ship_address.address1?
|
||||
|
||||
$scope.shipAddressFromBilling = =>
|
||||
angular.extend($scope.standingOrder.ship_address, $scope.standingOrder.bill_address)
|
||||
|
||||
@@ -157,10 +157,18 @@ feature 'Standing Orders' do
|
||||
expect(page).to have_input "bill_address_firstname", with: address.firstname
|
||||
expect(page).to have_input "bill_address_lastname", with: address.lastname
|
||||
expect(page).to have_input "bill_address_address1", with: address.address1
|
||||
click_button('Next')
|
||||
expect(page).to have_content 'can\'t be blank', count: 7 # 7 because country is set on Spree::Address.default
|
||||
|
||||
# Setting the billing address
|
||||
# Clear some elements of bill address
|
||||
fill_in "bill_address_firstname", with: ''
|
||||
fill_in "bill_address_lastname", with: ''
|
||||
fill_in "bill_address_address1", with: ''
|
||||
fill_in "bill_address_city", with: ''
|
||||
fill_in "bill_address_zipcode", with: ''
|
||||
fill_in "bill_address_phone", with: ''
|
||||
click_button('Next')
|
||||
expect(page).to have_content 'can\'t be blank', count: 6
|
||||
|
||||
# Re-setting the billing address
|
||||
fill_in "bill_address_firstname", with: 'Freda'
|
||||
fill_in "bill_address_lastname", with: 'Figapple'
|
||||
fill_in "bill_address_address1", with: '7 Tempany Lane'
|
||||
|
||||
Reference in New Issue
Block a user