Using true/false instead of YES/NO for address defaults and billing same as shipping

This commit is contained in:
Rob Harrington
2016-09-21 12:08:26 +10:00
committed by Bing Xie
parent 720ca17533
commit b59a1cc232
8 changed files with 23 additions and 23 deletions

View File

@@ -62,9 +62,9 @@ describe "CheckoutCtrl", ->
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'})
expect(storage.bind).toHaveBeenCalledWith(scope, "Checkout.ship_address_same_as_billing", {storeName: "#{prefix}_sameasbilling", defaultValue: true})
expect(storage.bind).toHaveBeenCalledWith(scope, "Checkout.default_bill_address", {storeName: "#{prefix}_defaultasbilladdress", defaultValue: false})
expect(storage.bind).toHaveBeenCalledWith(scope, "Checkout.default_ship_address", {storeName: "#{prefix}_defaultasshipaddress", defaultValue: false})
it "it can retrieve data from localstorage", ->

View File

@@ -126,20 +126,20 @@ describe 'Checkout service', ->
expect(Checkout.preprocess().ship_address).toBe(undefined)
it "munges the order attributes to clone ship address from bill address", ->
Checkout.ship_address_same_as_billing = 'NO'
Checkout.ship_address_same_as_billing = false
expect(Checkout.preprocess().ship_address_attributes).toEqual(orderData.ship_address)
Checkout.ship_address_same_as_billing = 'YES'
Checkout.ship_address_same_as_billing = true
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')
expect(Checkout.preprocess().default_bill_address).toEqual(false)
expect(Checkout.preprocess().default_ship_address).toEqual(false)
Checkout.default_bill_address = 'YES'
Checkout.default_ship_address = 'YES'
Checkout.default_bill_address = true
Checkout.default_ship_address = true
expect(Checkout.preprocess().default_bill_address).toEqual('YES')
expect(Checkout.preprocess().default_ship_address).toEqual('YES')
expect(Checkout.preprocess().default_bill_address).toEqual(true)
expect(Checkout.preprocess().default_ship_address).toEqual(true)
it "creates attributes for card fields", ->
source_attributes = Checkout.preprocess().payments_attributes[0].source_attributes