mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-06 22:36:07 +00:00
Set default billing address and shipping address
This commit is contained in:
@@ -59,10 +59,13 @@ describe "CheckoutCtrl", ->
|
||||
describe "Local storage", ->
|
||||
it "binds to localStorage when given a scope", ->
|
||||
prefix = "order_#{scope.order.id}#{CurrentUser.id or ""}#{CurrentHubMock.hub.id}"
|
||||
console.log prefix
|
||||
|
||||
field = scope.fieldsToBind[0]
|
||||
expect(storage.bind).toHaveBeenCalledWith(scope, "Checkout.order.#{field}", {storeName: "#{prefix}_#{field}"})
|
||||
expect(storage.bind).toHaveBeenCalledWith(scope, "Checkout.ship_address_same_as_billing", {storeName: "#{prefix}_sameasbilling", defaultValue: 'YES'})
|
||||
expect(storage.bind).toHaveBeenCalledWith(scope, "Checkout.default_bill_address", {storeName: "#{prefix}_defaultasbilladdress", defaultValue: 'NO'})
|
||||
expect(storage.bind).toHaveBeenCalledWith(scope, "Checkout.default_ship_address", {storeName: "#{prefix}_defaultasshipaddress", defaultValue: 'NO'})
|
||||
|
||||
|
||||
it "it can retrieve data from localstorage", ->
|
||||
prefix = "order_#{scope.order.id}#{CurrentUser.id or ""}#{CurrentHubMock.hub.id}"
|
||||
|
||||
@@ -131,6 +131,16 @@ describe 'Checkout service', ->
|
||||
Checkout.ship_address_same_as_billing = 'YES'
|
||||
expect(Checkout.preprocess().ship_address_attributes).toEqual(orderData.bill_address)
|
||||
|
||||
it "munges the default as billing address and shipping address", ->
|
||||
expect(Checkout.preprocess().default_bill_address).toEqual('NO')
|
||||
expect(Checkout.preprocess().default_ship_address).toEqual('NO')
|
||||
|
||||
Checkout.default_bill_address = 'YES'
|
||||
Checkout.default_ship_address = 'YES'
|
||||
|
||||
expect(Checkout.preprocess().default_bill_address).toEqual('YES')
|
||||
expect(Checkout.preprocess().default_ship_address).toEqual('YES')
|
||||
|
||||
it "creates attributes for card fields", ->
|
||||
source_attributes = Checkout.preprocess().payments_attributes[0].source_attributes
|
||||
expect(source_attributes).toBeDefined()
|
||||
|
||||
Reference in New Issue
Block a user