Working with ngForm and subcontrollers. Also fixing bulk order specs

This commit is contained in:
Will Marshall
2014-04-10 16:32:08 +10:00
parent 00f5d09d65
commit 5f62cb7ddb
15 changed files with 205 additions and 172 deletions

View File

@@ -7,6 +7,7 @@ describe "CheckoutCtrl", ->
module("Darkswarm")
order = {
submit: ->
navigate: ->
}
inject ($controller, $rootScope) ->
scope = $rootScope.$new()
@@ -22,23 +23,3 @@ describe "CheckoutCtrl", ->
spyOn(order, "submit")
scope.purchase(event)
expect(order.submit).toHaveBeenCalled()
it "finds a field by path", ->
scope.checkout =
path: "test"
expect(scope.field('path')).toEqual "test"
it "tests validity", ->
scope.checkout =
path:
$dirty: true
$invalid: true
expect(scope.fieldValid('path')).toEqual false
it "returns errors by path", ->
scope.checkout =
path:
$error:
email: true
required: true
expect(scope.fieldErrors('path')).toEqual ["must be email address", "must not be blank"].join ", "