Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5347f12
commit f1f07ed
Showing
8 changed files
with
121 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
www/waterfall_view/src/module/modal/modal.controller.spec.coffee
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
beforeEach -> | ||
module 'waterfall_view' | ||
# Mock modalService | ||
module ($provide) -> | ||
$provide.service '$modal', -> | ||
$provide.service '$modalInstance', -> close: -> | ||
null | ||
|
||
describe 'Waterfall modal controller', -> | ||
createController = $rootScope = $modalInstance = scope = null | ||
|
||
injected = ($injector) -> | ||
$controller = $injector.get('$controller') | ||
$rootScope = $injector.get('$rootScope') | ||
$modalInstance = $injector.get('$modalInstance') | ||
scope = $rootScope.$new() | ||
|
||
createController = -> | ||
$controller 'waterfallModalController as m', | ||
$scope: scope | ||
selectedBuild: {} | ||
|
||
beforeEach(inject(injected)) | ||
|
||
it 'should be defined', -> | ||
createController() | ||
m = scope.m | ||
expect(m).toBeDefined() | ||
# close function should be to defined | ||
expect(m.close).toBeDefined() | ||
expect(typeof m.close).toBe('function') | ||
|
||
it 'should call close() on stateChangeStart event', -> | ||
createController() | ||
m = scope.m | ||
spyOn(m, 'close') | ||
$rootScope.$broadcast('$stateChangeStart') | ||
expect(m.close).toHaveBeenCalled() | ||
|
||
it 'should call $modalInstance.close on close()', -> | ||
createController() | ||
m = scope.m | ||
spyOn($modalInstance, 'close') | ||
expect($modalInstance.close).not.toHaveBeenCalled() | ||
m.close() | ||
expect($modalInstance.close).toHaveBeenCalled() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters