Skip to content

Commit

Permalink
fix(app): navPop() does not go to previous tab
Browse files Browse the repository at this point in the history
references #7611
  • Loading branch information
manucorporat committed Dec 3, 2016
1 parent b63344c commit eebb062
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
9 changes: 1 addition & 8 deletions src/components/app/app.ts
Expand Up @@ -264,14 +264,7 @@ export class App {
if (nav) {
if (isTabs(nav)) {
// FYI, using "nav instanceof Tabs" throws a Promise runtime error for whatever reason, idk
// this is a Tabs container
// 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();
}
// on tabs, we do nothing. see issue #7611

} else if (isNav(nav) && nav.length() > 1) {
// this nav controller has more than one view
Expand Down
6 changes: 3 additions & 3 deletions src/components/app/test/app.spec.ts
Expand Up @@ -9,7 +9,7 @@ describe('App', () => {

describe('goBack', () => {

it('should select the previous tab', () => {
it('should not select the previous tab', () => {
let nav = mockNavController();
app._setRootNav(nav);

Expand All @@ -31,11 +31,11 @@ describe('App', () => {

app.goBack();

expect(tabs.select).toHaveBeenCalledWith(tab1);
expect(tabs.select).not.toHaveBeenCalled();
expect(tab1.pop).not.toHaveBeenCalled();
expect(tab2.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', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/gestures/slide-gesture.ts
@@ -1,6 +1,6 @@
import { PanGesture } from './drag-gesture';
import { clamp, assert } from '../util/util';
import { nativeRaf, pointerCoord } from '../util/dom';
import { pointerCoord } from '../util/dom';

/**
* @private
Expand Down

0 comments on commit eebb062

Please sign in to comment.