mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 05:21:52 +08:00
Merge branch 'master' of https://github.com/driftyco/ionic
This commit is contained in:
@ -7,7 +7,7 @@ import { Platform } from '../../../platform/platform';
|
|||||||
|
|
||||||
describe('App', () => {
|
describe('App', () => {
|
||||||
|
|
||||||
describe('navPop', () => {
|
describe('goBack', () => {
|
||||||
|
|
||||||
it('should select the previous tab', () => {
|
it('should select the previous tab', () => {
|
||||||
let nav = mockNavController();
|
let nav = mockNavController();
|
||||||
@ -29,7 +29,7 @@ describe('App', () => {
|
|||||||
spyOn(tab2, 'pop');
|
spyOn(tab2, 'pop');
|
||||||
spyOn(portal, 'pop');
|
spyOn(portal, 'pop');
|
||||||
|
|
||||||
app.navPop();
|
app.goBack();
|
||||||
|
|
||||||
expect(tabs.select).toHaveBeenCalledWith(tab1);
|
expect(tabs.select).toHaveBeenCalledWith(tab1);
|
||||||
expect(tab1.pop).not.toHaveBeenCalled();
|
expect(tab1.pop).not.toHaveBeenCalled();
|
||||||
@ -58,7 +58,7 @@ describe('App', () => {
|
|||||||
let view2 = mockView();
|
let view2 = mockView();
|
||||||
tab2._views = [view1, view2];
|
tab2._views = [view1, view2];
|
||||||
|
|
||||||
app.navPop();
|
app.goBack();
|
||||||
|
|
||||||
expect(tab2.pop).toHaveBeenCalled();
|
expect(tab2.pop).toHaveBeenCalled();
|
||||||
expect(portal.pop).not.toHaveBeenCalled();
|
expect(portal.pop).not.toHaveBeenCalled();
|
||||||
@ -81,7 +81,7 @@ describe('App', () => {
|
|||||||
let view2 = mockView();
|
let view2 = mockView();
|
||||||
tab2._views = [view1, view2];
|
tab2._views = [view1, view2];
|
||||||
|
|
||||||
app.navPop();
|
app.goBack();
|
||||||
|
|
||||||
expect(tab2.pop).toHaveBeenCalled();
|
expect(tab2.pop).toHaveBeenCalled();
|
||||||
expect(platform.exitApp).not.toHaveBeenCalled();
|
expect(platform.exitApp).not.toHaveBeenCalled();
|
||||||
@ -106,7 +106,7 @@ describe('App', () => {
|
|||||||
let nestedView1 = mockView();
|
let nestedView1 = mockView();
|
||||||
mockViews(nestedNav, [nestedView1]);
|
mockViews(nestedNav, [nestedView1]);
|
||||||
|
|
||||||
app.navPop();
|
app.goBack();
|
||||||
|
|
||||||
expect(portal.pop).not.toHaveBeenCalled();
|
expect(portal.pop).not.toHaveBeenCalled();
|
||||||
expect(rootNav.pop).toHaveBeenCalled();
|
expect(rootNav.pop).toHaveBeenCalled();
|
||||||
@ -133,7 +133,7 @@ describe('App', () => {
|
|||||||
let nestedView2 = mockView();
|
let nestedView2 = mockView();
|
||||||
mockViews(nestedNav, [nestedView1, nestedView2]);
|
mockViews(nestedNav, [nestedView1, nestedView2]);
|
||||||
|
|
||||||
app.navPop();
|
app.goBack();
|
||||||
|
|
||||||
expect(portal.pop).not.toHaveBeenCalled();
|
expect(portal.pop).not.toHaveBeenCalled();
|
||||||
expect(rootNav.pop).not.toHaveBeenCalled();
|
expect(rootNav.pop).not.toHaveBeenCalled();
|
||||||
@ -156,7 +156,7 @@ describe('App', () => {
|
|||||||
let overlay1 = mockView();
|
let overlay1 = mockView();
|
||||||
mockViews(portal, [overlay1]);
|
mockViews(portal, [overlay1]);
|
||||||
|
|
||||||
app.navPop();
|
app.goBack();
|
||||||
|
|
||||||
expect(portal.pop).toHaveBeenCalled();
|
expect(portal.pop).toHaveBeenCalled();
|
||||||
expect(nav.pop).not.toHaveBeenCalled();
|
expect(nav.pop).not.toHaveBeenCalled();
|
||||||
@ -175,7 +175,7 @@ describe('App', () => {
|
|||||||
let view2 = mockView();
|
let view2 = mockView();
|
||||||
mockViews(nav, [view1, view2]);
|
mockViews(nav, [view1, view2]);
|
||||||
|
|
||||||
app.navPop();
|
app.goBack();
|
||||||
|
|
||||||
expect(portal.pop).not.toHaveBeenCalled();
|
expect(portal.pop).not.toHaveBeenCalled();
|
||||||
expect(nav.pop).toHaveBeenCalled();
|
expect(nav.pop).toHaveBeenCalled();
|
||||||
@ -196,7 +196,7 @@ describe('App', () => {
|
|||||||
expect(app.getActiveNav()).toBe(nav);
|
expect(app.getActiveNav()).toBe(nav);
|
||||||
expect(nav.first()).toBe(view1);
|
expect(nav.first()).toBe(view1);
|
||||||
|
|
||||||
app.navPop();
|
app.goBack();
|
||||||
|
|
||||||
expect(portal.pop).not.toHaveBeenCalled();
|
expect(portal.pop).not.toHaveBeenCalled();
|
||||||
expect(nav.pop).not.toHaveBeenCalled();
|
expect(nav.pop).not.toHaveBeenCalled();
|
||||||
@ -219,7 +219,7 @@ describe('App', () => {
|
|||||||
expect(app.getActiveNav()).toBe(nav);
|
expect(app.getActiveNav()).toBe(nav);
|
||||||
expect(nav.first()).toBe(view1);
|
expect(nav.first()).toBe(view1);
|
||||||
|
|
||||||
app.navPop();
|
app.goBack();
|
||||||
|
|
||||||
expect(portal.pop).not.toHaveBeenCalled();
|
expect(portal.pop).not.toHaveBeenCalled();
|
||||||
expect(nav.pop).not.toHaveBeenCalled();
|
expect(nav.pop).not.toHaveBeenCalled();
|
||||||
@ -239,7 +239,7 @@ describe('App', () => {
|
|||||||
|
|
||||||
app.setEnabled(false, 10000);
|
app.setEnabled(false, 10000);
|
||||||
|
|
||||||
app.navPop();
|
app.goBack();
|
||||||
|
|
||||||
expect(portal.pop).not.toHaveBeenCalled();
|
expect(portal.pop).not.toHaveBeenCalled();
|
||||||
expect(nav.pop).not.toHaveBeenCalled();
|
expect(nav.pop).not.toHaveBeenCalled();
|
||||||
@ -249,7 +249,7 @@ describe('App', () => {
|
|||||||
it('should not go back if there is no root nav', () => {
|
it('should not go back if there is no root nav', () => {
|
||||||
spyOn(platform, 'exitApp');
|
spyOn(platform, 'exitApp');
|
||||||
|
|
||||||
app.navPop();
|
app.goBack();
|
||||||
|
|
||||||
expect(platform.exitApp).not.toHaveBeenCalled();
|
expect(platform.exitApp).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
@ -25,7 +25,7 @@ import { DomController } from '../util/dom-controller';
|
|||||||
*/
|
*/
|
||||||
export class NavControllerBase extends Ion implements NavController {
|
export class NavControllerBase extends Ion implements NavController {
|
||||||
|
|
||||||
_children: NavController[] = [];
|
_children: any[] = [];
|
||||||
_ids: number = -1;
|
_ids: number = -1;
|
||||||
_init = false;
|
_init = false;
|
||||||
_isPortal: boolean;
|
_isPortal: boolean;
|
||||||
@ -883,15 +883,15 @@ export class NavControllerBase extends Ion implements NavController {
|
|||||||
this._app.viewWillUnload.emit(view);
|
this._app.viewWillUnload.emit(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
getActiveChildNav(): NavController {
|
getActiveChildNav(): any {
|
||||||
return this._children[this._children.length - 1];
|
return this._children[this._children.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
registerChildNav(nav: NavController) {
|
registerChildNav(nav: any) {
|
||||||
this._children.push(nav);
|
this._children.push(nav);
|
||||||
}
|
}
|
||||||
|
|
||||||
unregisterChildNav(nav: NavController) {
|
unregisterChildNav(nav: any) {
|
||||||
removeArrayItem(this._children, nav);
|
removeArrayItem(this._children, nav);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,5 +600,5 @@ export abstract class NavController {
|
|||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
abstract registerChildNav(nav: NavController);
|
abstract registerChildNav(nav: any);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user