|
1 |
| -describe('navClear directive', function() { |
| 1 | +ddescribe('navClear directive', function() { |
2 | 2 | beforeEach(module('ionic'));
|
3 |
| - it('should call nextViewOptions on click', inject(function($rootScope, $compile, $ionicViewService) { |
| 3 | + |
| 4 | + it('should call nextViewOptions on click & stateChangeSuccess', inject(function($rootScope, $compile, $ionicViewService) { |
4 | 5 | spyOn($ionicViewService, 'nextViewOptions');
|
5 | 6 | var el = $compile('<div nav-clear>')($rootScope.$new());
|
| 7 | + |
6 | 8 | expect($ionicViewService.nextViewOptions).not.toHaveBeenCalled();
|
7 | 9 | el.triggerHandler('click');
|
| 10 | + el.scope().$broadcast('$stateChangeStart'); |
8 | 11 | expect($ionicViewService.nextViewOptions).toHaveBeenCalled();
|
9 | 12 | expect($ionicViewService.nextViewOptions.mostRecentCall.args[0]).toEqual({
|
10 | 13 | disableAnimate: true,
|
11 | 14 | disableBack: true
|
12 | 15 | });
|
13 | 16 | }));
|
14 |
| - |
15 |
| - it('should run its click action before ngClick', inject(function($rootScope, $compile, $ionicViewService) { |
16 |
| - spyOn($ionicViewService, 'nextViewOptions'); |
17 |
| - var el = $compile('<div nav-clear ng-click="method()">')($rootScope.$new()); |
18 |
| - var done = false; |
19 |
| - |
20 |
| - //navClear should've called nextViewOptions by the time the ngClick handler runs |
21 |
| - el.scope().method = function() { |
22 |
| - expect($ionicViewService.nextViewOptions).toHaveBeenCalled(); |
23 |
| - done = true; |
24 |
| - }; |
25 |
| - el.triggerHandler('click'); |
26 |
| - expect(done).toBe(true); |
27 |
| - })); |
28 | 17 | });
|
0 commit comments