mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-21 04:53:58 +08:00
@ -264,14 +264,7 @@ export class App {
|
|||||||
if (nav) {
|
if (nav) {
|
||||||
if (isTabs(nav)) {
|
if (isTabs(nav)) {
|
||||||
// FYI, using "nav instanceof Tabs" throws a Promise runtime error for whatever reason, idk
|
// FYI, using "nav instanceof Tabs" throws a Promise runtime error for whatever reason, idk
|
||||||
// this is a Tabs container
|
// on tabs, we do nothing. see issue #7611
|
||||||
// see if there is a valid previous tab to go to
|
|
||||||
let prevTab = nav.previousTab(true);
|
|
||||||
if (prevTab) {
|
|
||||||
console.debug('app, goBack previous tab');
|
|
||||||
nav.select(prevTab);
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (isNav(nav) && nav.length() > 1) {
|
} else if (isNav(nav) && nav.length() > 1) {
|
||||||
// this nav controller has more than one view
|
// this nav controller has more than one view
|
||||||
|
@ -9,7 +9,7 @@ describe('App', () => {
|
|||||||
|
|
||||||
describe('goBack', () => {
|
describe('goBack', () => {
|
||||||
|
|
||||||
it('should select the previous tab', () => {
|
it('should not select the previous tab', () => {
|
||||||
let nav = mockNavController();
|
let nav = mockNavController();
|
||||||
app._setRootNav(nav);
|
app._setRootNav(nav);
|
||||||
|
|
||||||
@ -31,11 +31,11 @@ describe('App', () => {
|
|||||||
|
|
||||||
app.goBack();
|
app.goBack();
|
||||||
|
|
||||||
expect(tabs.select).toHaveBeenCalledWith(tab1);
|
expect(tabs.select).not.toHaveBeenCalled();
|
||||||
expect(tab1.pop).not.toHaveBeenCalled();
|
expect(tab1.pop).not.toHaveBeenCalled();
|
||||||
expect(tab2.pop).not.toHaveBeenCalled();
|
expect(tab2.pop).not.toHaveBeenCalled();
|
||||||
expect(portal.pop).not.toHaveBeenCalled();
|
expect(portal.pop).not.toHaveBeenCalled();
|
||||||
expect(platform.exitApp).not.toHaveBeenCalled();
|
expect(platform.exitApp).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should pop from the active tab, when tabs is nested is the root nav', () => {
|
it('should pop from the active tab, when tabs is nested is the root nav', () => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { PanGesture } from './drag-gesture';
|
import { PanGesture } from './drag-gesture';
|
||||||
import { clamp, assert } from '../util/util';
|
import { clamp, assert } from '../util/util';
|
||||||
import { nativeRaf, pointerCoord } from '../util/dom';
|
import { pointerCoord } from '../util/dom';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
|
Reference in New Issue
Block a user