mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-06 02:51:34 +00:00
Remove angular from shipping methods tab in enterprise/edit
This commit is contained in:
@@ -3,7 +3,6 @@ describe "enterpriseCtrl", ->
|
||||
scope = null
|
||||
enterprise = null
|
||||
PaymentMethods = null
|
||||
ShippingMethods = null
|
||||
Enterprises = null
|
||||
StatusMessage = null
|
||||
|
||||
@@ -16,15 +15,13 @@ describe "enterpriseCtrl", ->
|
||||
id: 98
|
||||
PaymentMethods =
|
||||
paymentMethods: "payment methods"
|
||||
ShippingMethods =
|
||||
shippingMethods: "shipping methods"
|
||||
receivesNotifications = 99
|
||||
|
||||
inject ($rootScope, $controller, _Enterprises_, _StatusMessage_) ->
|
||||
scope = $rootScope
|
||||
Enterprises = _Enterprises_
|
||||
StatusMessage = _StatusMessage_
|
||||
ctrl = $controller "enterpriseCtrl", {$scope: scope, enterprise: enterprise, EnterprisePaymentMethods: PaymentMethods, EnterpriseShippingMethods: ShippingMethods, Enterprises: Enterprises, StatusMessage: StatusMessage, receivesNotifications: receivesNotifications}
|
||||
ctrl = $controller "enterpriseCtrl", {$scope: scope, enterprise: enterprise, EnterprisePaymentMethods: PaymentMethods, Enterprises: Enterprises, StatusMessage: StatusMessage, receivesNotifications: receivesNotifications}
|
||||
|
||||
describe "initialisation", ->
|
||||
it "stores enterprise", ->
|
||||
@@ -33,9 +30,6 @@ describe "enterpriseCtrl", ->
|
||||
it "stores payment methods", ->
|
||||
expect(scope.PaymentMethods).toBe PaymentMethods.paymentMethods
|
||||
|
||||
it "stores shipping methods", ->
|
||||
expect(scope.ShippingMethods).toBe ShippingMethods.shippingMethods
|
||||
|
||||
describe "removing logo", ->
|
||||
deferred = null
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
describe "EnterpriseShippingMethods service", ->
|
||||
enterprise = null
|
||||
ShippingMethods = null
|
||||
EnterpriseShippingMethods = null
|
||||
|
||||
beforeEach ->
|
||||
enterprise =
|
||||
shipping_method_ids: [ 1, 3 ]
|
||||
ShippingMethods =
|
||||
all: [ { id: 1 }, { id: 2 }, { id: 3 }, { id: 4 } ]
|
||||
|
||||
module 'admin.enterprises'
|
||||
module ($provide) ->
|
||||
$provide.value 'ShippingMethods', ShippingMethods
|
||||
$provide.value 'enterprise', enterprise
|
||||
null
|
||||
|
||||
inject (_EnterpriseShippingMethods_) ->
|
||||
EnterpriseShippingMethods = _EnterpriseShippingMethods_
|
||||
|
||||
describe "selecting shipping methods", ->
|
||||
it "sets the selected property of each shipping method", ->
|
||||
expect(ShippingMethods.all[0].selected).toBe true
|
||||
expect(ShippingMethods.all[1].selected).toBe false
|
||||
expect(ShippingMethods.all[2].selected).toBe true
|
||||
expect(ShippingMethods.all[3].selected).toBe false
|
||||
|
||||
describe "determining shipping method colour", ->
|
||||
it "returns 'blue' when at least one shipping method is selected", ->
|
||||
spyOn(EnterpriseShippingMethods, "selectedCount").and.returnValue 1
|
||||
expect(EnterpriseShippingMethods.displayColor()).toBe "blue"
|
||||
|
||||
it "returns 'red' when no shipping methods are selected", ->
|
||||
spyOn(EnterpriseShippingMethods, "selectedCount").and.returnValue 0
|
||||
expect(EnterpriseShippingMethods.displayColor()).toBe "red"
|
||||
|
||||
it "returns 'red' when no shipping methods exist", ->
|
||||
EnterpriseShippingMethods.shippingMethods = []
|
||||
spyOn(EnterpriseShippingMethods, "selectedCount").and.returnValue 1
|
||||
expect(EnterpriseShippingMethods.displayColor()).toBe "red"
|
||||
|
||||
describe "counting selected shipping methods", ->
|
||||
it "counts only shipping methods with selected: true", ->
|
||||
expect(EnterpriseShippingMethods.selectedCount()).toBe 2
|
||||
Reference in New Issue
Block a user