mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
test(view-controller): adds isOverlay asserts
This commit is contained in:
@ -4,7 +4,7 @@ import { Title, DOCUMENT } from '@angular/platform-browser';
|
|||||||
import { IonicApp } from './app-root';
|
import { IonicApp } from './app-root';
|
||||||
import * as Constants from './app-constants';
|
import * as Constants from './app-constants';
|
||||||
import { ClickBlock } from './click-block';
|
import { ClickBlock } from './click-block';
|
||||||
import { runInDev } from '../../util/util';
|
import { runInDev, assert } from '../../util/util';
|
||||||
import { Config } from '../../config/config';
|
import { Config } from '../../config/config';
|
||||||
import { isNav, NavOptions, DIRECTION_FORWARD, DIRECTION_BACK } from '../../navigation/nav-util';
|
import { isNav, NavOptions, DIRECTION_FORWARD, DIRECTION_BACK } from '../../navigation/nav-util';
|
||||||
import { MenuController } from './menu-controller';
|
import { MenuController } from './menu-controller';
|
||||||
@ -226,6 +226,8 @@ export class App {
|
|||||||
* @hidden
|
* @hidden
|
||||||
*/
|
*/
|
||||||
present(enteringView: ViewController, opts: NavOptions, appPortal?: number): Promise<any> {
|
present(enteringView: ViewController, opts: NavOptions, appPortal?: number): Promise<any> {
|
||||||
|
assert(enteringView.isOverlay, 'presented view controller needs to be an overlay');
|
||||||
|
|
||||||
const portal = this._appRoot._getPortal(appPortal);
|
const portal = this._appRoot._getPortal(appPortal);
|
||||||
|
|
||||||
// Set Nav must be set here in order to dimiss() work synchnously.
|
// Set Nav must be set here in order to dimiss() work synchnously.
|
||||||
|
@ -9,6 +9,7 @@ import { Keyboard } from '../../platform/keyboard';
|
|||||||
import { NavControllerBase } from '../../navigation/nav-controller-base';
|
import { NavControllerBase } from '../../navigation/nav-controller-base';
|
||||||
import { Platform } from '../../platform/platform';
|
import { Platform } from '../../platform/platform';
|
||||||
import { TransitionController } from '../../transitions/transition-controller';
|
import { TransitionController } from '../../transitions/transition-controller';
|
||||||
|
import { ViewController } from '../../navigation/view-controller';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hidden
|
* @hidden
|
||||||
@ -40,8 +41,10 @@ export class OverlayPortal extends NavControllerBase {
|
|||||||
|
|
||||||
// on every page change make sure the portal has
|
// on every page change make sure the portal has
|
||||||
// dismissed any views that should be auto dismissed on page change
|
// dismissed any views that should be auto dismissed on page change
|
||||||
app.viewDidLeave.subscribe((ev: any) => {
|
app.viewDidLeave.subscribe((view: ViewController) => {
|
||||||
!ev.isOverlay && this.dismissPageChangeViews();
|
if (!view.isOverlay) {
|
||||||
|
this.dismissPageChangeViews();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1117,7 +1117,7 @@ export class NavControllerBase extends Ion implements NavController {
|
|||||||
dismissPageChangeViews() {
|
dismissPageChangeViews() {
|
||||||
for (let view of this._views) {
|
for (let view of this._views) {
|
||||||
if (view.data && view.data.dismissOnPageChange) {
|
if (view.data && view.data.dismissOnPageChange) {
|
||||||
view.dismiss().catch(null);
|
view.dismiss().catch(() => {});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user