mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-18 00:17:25 +00:00
Using events to update index row text on save, adding alert icons for enterprises without producer or package selected
This commit is contained in:
@@ -21,6 +21,7 @@ describe "indexPanelCtrl", ->
|
||||
|
||||
beforeEach inject ($q) ->
|
||||
spyOn(scope, "saved").andReturn false
|
||||
spyOn(scope, "$emit")
|
||||
deferred = $q.defer()
|
||||
spyOn(Enterprises, "save").andReturn(deferred.promise)
|
||||
scope.save()
|
||||
@@ -33,10 +34,12 @@ describe "indexPanelCtrl", ->
|
||||
deferred.resolve()
|
||||
$rootScope.$digest()
|
||||
|
||||
|
||||
it "sets scope.saving to false", ->
|
||||
expect(scope.saving).toBe false
|
||||
|
||||
it "emits an 'enterprise:updated' event", ->
|
||||
expect(scope.$emit).toHaveBeenCalledWith("enterprise:updated")
|
||||
|
||||
describe "when the save is unsuccessful", ->
|
||||
beforeEach inject ($rootScope) ->
|
||||
deferred.reject({ status: 404 })
|
||||
@@ -44,3 +47,6 @@ describe "indexPanelCtrl", ->
|
||||
|
||||
it "sets scope.saving to false", ->
|
||||
expect(scope.saving).toBe false
|
||||
|
||||
it "does not emit an 'enterprise:updated' event", ->
|
||||
expect(scope.$emit).not.toHaveBeenCalled()
|
||||
|
||||
Reference in New Issue
Block a user