mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 05:21:52 +08:00
test(modal): make sure enableBackdropDismiss works correctly
references #9185
This commit is contained in:
@ -10,7 +10,10 @@
|
||||
<ion-content padding>
|
||||
|
||||
<button ion-button block class="e2eOpenActionSheet" (click)="presentActionSheet1()">Present Action Sheet 1</button>
|
||||
<button ion-button block (click)="presentActionSheet2()">Present Action Sheet 2</button>
|
||||
<button ion-button block (click)="presentActionSheet2()">
|
||||
Present Action Sheet 2
|
||||
<span style="font-size:0.5em; text-transform: none"> (enableBackdropDismiss: false)</span>
|
||||
</button>
|
||||
<button ion-button block (click)="presentActionSheet3()">Present Action Sheet 3</button>
|
||||
|
||||
<pre>
|
||||
|
@ -40,6 +40,7 @@ export class LoadingCmp {
|
||||
params: NavParams,
|
||||
renderer: Renderer
|
||||
) {
|
||||
assert(params.data, 'params data must be valid');
|
||||
this.gestureBlocker = gestureCtrl.createBlocker(BLOCK_ALL);
|
||||
this.d = params.data;
|
||||
|
||||
|
@ -32,10 +32,13 @@ export class ModalCmp {
|
||||
public _viewCtrl: ViewController,
|
||||
gestureCtrl: GestureController
|
||||
) {
|
||||
let opts = _navParams.get('opts');
|
||||
assert(opts, 'modal data must be valid');
|
||||
|
||||
this._gestureBlocker = gestureCtrl.createBlocker({
|
||||
disable: [GESTURE_MENU_SWIPE, GESTURE_GO_BACK_SWIPE]
|
||||
});
|
||||
this._bdDismiss = _navParams.data.opts.enableBackdropDismiss;
|
||||
this._bdDismiss = opts.enableBackdropDismiss;
|
||||
}
|
||||
|
||||
ionViewPreLoad() {
|
||||
|
@ -15,7 +15,8 @@ import { ViewController } from '../../navigation/view-controller';
|
||||
export class Modal extends ViewController {
|
||||
private _app: App;
|
||||
|
||||
constructor(app: App, component: any, data: any = {}, opts: ModalOptions = {}) {
|
||||
constructor(app: App, component: any, data: any, opts: ModalOptions = {}) {
|
||||
data = data || {};
|
||||
data.component = component;
|
||||
opts.showBackdrop = isPresent(opts.showBackdrop) ? !!opts.showBackdrop : true;
|
||||
opts.enableBackdropDismiss = isPresent(opts.enableBackdropDismiss) ? !!opts.enableBackdropDismiss : true;
|
||||
|
@ -62,6 +62,10 @@ export class E2EPage {
|
||||
this.platforms = platform.platforms();
|
||||
}
|
||||
|
||||
push() {
|
||||
this.navCtrl.push(E2EPage);
|
||||
}
|
||||
|
||||
presentModal() {
|
||||
let modal = this.modalCtrl.create(ModalPassData, { userId: 8675309 });
|
||||
modal.present();
|
||||
@ -77,7 +81,9 @@ export class E2EPage {
|
||||
}
|
||||
|
||||
presentModalChildNav() {
|
||||
this.modalCtrl.create(ContactUs).present();
|
||||
this.modalCtrl.create(ContactUs, null, {
|
||||
enableBackdropDismiss: false
|
||||
}).present();
|
||||
}
|
||||
|
||||
presentToolbarModal() {
|
||||
|
@ -2,6 +2,9 @@
|
||||
|
||||
<ion-navbar>
|
||||
<ion-title>Modals</ion-title>
|
||||
<ion-buttons end>
|
||||
<button ion-button (click)="push()">Push</button>
|
||||
</ion-buttons>
|
||||
</ion-navbar>
|
||||
|
||||
</ion-header>
|
||||
@ -13,7 +16,10 @@
|
||||
<button ion-button (click)="presentModal()">Present modal, pass params</button>
|
||||
</p>
|
||||
<p>
|
||||
<button ion-button class="e2eOpenModal" (click)="presentModalChildNav()">Present modal w/ child ion-nav</button>
|
||||
<button ion-button class="e2eOpenModal" (click)="presentModalChildNav()">
|
||||
Present modal w/ child ion-nav
|
||||
<span style="font-size:0.5em; text-transform: none"> (enableBackdropDismiss: false)</span>
|
||||
</button>
|
||||
</p>
|
||||
<p>
|
||||
<button ion-button class="e2eOpenToolbarModal" (click)="presentToolbarModal()">Present modal w/ toolbar (and alert)</button>
|
||||
|
Reference in New Issue
Block a user