|
| 1 | +import {ViewControllerMock} from './view-controller'; |
| 2 | + |
1 | 3 | export class NavControllerMock {
|
2 | 4 | public static instance(): any {
|
3 |
| - |
4 |
| - let instance = jasmine.createSpyObj('navController', [ |
| 5 | + let instance: any = jasmine.createSpyObj('NavController', [ |
| 6 | + 'goToRoot', |
| 7 | + 'initPane', |
| 8 | + 'pangeChanged', |
5 | 9 | 'push',
|
| 10 | + 'insert', |
| 11 | + 'insertPage', |
6 | 12 | 'pop',
|
7 |
| - 'ionViewDidLoad', |
8 |
| - 'ionViewWillEnter', |
9 |
| - 'ionViewDidEnter', |
10 |
| - 'ionViewWillLeave', |
11 |
| - 'ionViewWillUnload', |
12 |
| - 'ionViewCanEnter', |
13 |
| - 'ionViewCanLeave' |
| 13 | + 'popTo', |
| 14 | + 'popToRoot', |
| 15 | + 'popAll', |
| 16 | + 'remove', |
| 17 | + 'removeView', |
| 18 | + 'setRoot', |
| 19 | + 'setPages', |
| 20 | + 'hasChildren', |
| 21 | + 'getActiveChildNav', |
| 22 | + 'registerChildNav', |
| 23 | + 'unregisterChildNav', |
| 24 | + 'destroy', |
| 25 | + 'swipeBackStart', |
| 26 | + 'swipeBackProgress', |
| 27 | + 'swipeBackEnd', |
| 28 | + 'canSwipeBack', |
| 29 | + 'canGoBack', |
| 30 | + 'isTransitioning', |
| 31 | + 'setTransitioning', |
| 32 | + 'getActive', |
| 33 | + 'isActive', |
| 34 | + 'getByIndex', |
| 35 | + 'getPrevious', |
| 36 | + 'first', |
| 37 | + 'last', |
| 38 | + 'indexOf', |
| 39 | + 'length', |
| 40 | + 'getViews', |
| 41 | + 'isSwipeBackEnabled', |
| 42 | + 'dismissPageChangeViews', |
| 43 | + 'setViewPort', |
| 44 | + 'resize' |
14 | 45 | ]);
|
15 | 46 |
|
| 47 | + instance.goToRoot.and.returnValue(Promise.resolve()); |
| 48 | + instance.initPane.and.returnValue(1); |
| 49 | + |
| 50 | + instance['root'] = ViewControllerMock.instance(); |
| 51 | + instance['rootParams'] = {}; |
| 52 | + |
16 | 53 | instance.push.and.returnValue(Promise.resolve());
|
| 54 | + instance.insert.and.returnValue(Promise.resolve()); |
| 55 | + instance.insertPage.and.returnValue(Promise.resolve()); |
17 | 56 | instance.pop.and.returnValue(Promise.resolve());
|
18 |
| - instance.ionViewCanEnter.and.returnValue(true); |
19 |
| - instance.ionViewCanLeave.and.returnValue(true); |
| 57 | + instance.popTo.and.returnValue(Promise.resolve()); |
| 58 | + instance.popToRoot.and.returnValue(Promise.resolve()); |
| 59 | + instance.popAll.and.returnValue(Promise.resolve()); |
| 60 | + instance.remove.and.returnValue(Promise.resolve()); |
| 61 | + instance.removeView.and.returnValue(Promise.resolve()); |
| 62 | + instance.setRoot.and.returnValue(Promise.resolve()); |
| 63 | + instance.setPages.and.returnValue(Promise.resolve()); |
| 64 | + instance.hasChildren.and.returnValue(true); |
| 65 | + instance.canSwipeBack.and.returnValue(true); |
| 66 | + instance.canGoBack.and.returnValue(true); |
| 67 | + instance.isTransitioning.and.returnValue(false); |
| 68 | + instance.getActive.and.returnValue(ViewControllerMock.instance()); |
| 69 | + instance.isActive.and.returnValue(true); |
| 70 | + instance.getByIndex.and.returnValue(ViewControllerMock.instance()); |
| 71 | + instance.getPrevious.and.returnValue(ViewControllerMock.instance()); |
| 72 | + instance.first.and.returnValue(ViewControllerMock.instance()); |
| 73 | + instance.last.and.returnValue(ViewControllerMock.instance()); |
| 74 | + instance.indexOf.and.returnValue(0); |
| 75 | + instance.length.and.returnValue(0); |
| 76 | + instance.getViews.and.returnValue([]); |
| 77 | + instance.isSwipeBackEnabled.and.returnValue(true); |
20 | 78 |
|
21 | 79 | return instance;
|
22 | 80 | }
|
|
0 commit comments