mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-26 20:56:48 +00:00
29 lines
679 B
CoffeeScript
29 lines
679 B
CoffeeScript
describe "CheckoutCtrl", ->
|
|
ctrl = null
|
|
scope = null
|
|
Order = null
|
|
|
|
beforeEach ->
|
|
module("Darkswarm")
|
|
angular.module('Darkswarm').value('user', {})
|
|
Order = {
|
|
submit: ->
|
|
navigate: ->
|
|
order:
|
|
id: 1
|
|
}
|
|
inject ($controller, $rootScope) ->
|
|
scope = $rootScope.$new()
|
|
ctrl = $controller 'CheckoutCtrl', {$scope: scope, Order: Order}
|
|
|
|
it "defaults the user accordion to visible", ->
|
|
expect(scope.accordion.user).toEqual true
|
|
|
|
it "delegates to the service on submit", ->
|
|
event = {
|
|
preventDefault: ->
|
|
}
|
|
spyOn(Order, "submit")
|
|
scope.purchase(event)
|
|
expect(Order.submit).toHaveBeenCalled()
|