mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
test(modal): adds e2e tests for open rc0 issues
references #8616 references #8597 references #8573
This commit is contained in:
@ -1,8 +1,8 @@
|
|||||||
import { Component, Injectable, NgModule } from '@angular/core';
|
import { Component, Injectable, NgModule } from '@angular/core';
|
||||||
|
|
||||||
import { ActionSheetController, App, Config,
|
import { ActionSheetController, AlertController, App, Config,
|
||||||
IonicApp, IonicModule, ModalController, NavController,
|
IonicApp, IonicModule, ModalController, NavController,
|
||||||
NavParams, Platform, ViewController } from '../../../..';
|
NavParams, Platform, ToastController, ViewController } from '../../../..';
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -67,7 +67,7 @@ export class E2EPage {
|
|||||||
console.timeEnd('modal');
|
console.timeEnd('modal');
|
||||||
});
|
});
|
||||||
modal.onDidDismiss((data: any) => {
|
modal.onDidDismiss((data: any) => {
|
||||||
console.log('modal data', data);
|
console.log('DID DISMISS modal data', data);
|
||||||
console.timeEnd('modal');
|
console.timeEnd('modal');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -89,10 +89,6 @@ export class E2EPage {
|
|||||||
modal.present();
|
modal.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
presentNavigableModal() {
|
|
||||||
this.modalCtrl.create(NavigableModal).present();
|
|
||||||
}
|
|
||||||
|
|
||||||
ionViewDidLoad() {
|
ionViewDidLoad() {
|
||||||
console.log('E2EPage ionViewDidLoad fired');
|
console.log('E2EPage ionViewDidLoad fired');
|
||||||
}
|
}
|
||||||
@ -114,61 +110,6 @@ export class E2EPage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component({
|
|
||||||
template: `
|
|
||||||
<ion-header>
|
|
||||||
<ion-navbar>
|
|
||||||
<ion-buttons>
|
|
||||||
<button ion-button (click)="dismiss()">Close</button>
|
|
||||||
</ion-buttons>
|
|
||||||
<ion-title>Page One</ion-title>
|
|
||||||
</ion-navbar>
|
|
||||||
</ion-header>
|
|
||||||
|
|
||||||
<ion-content>
|
|
||||||
<div padding>
|
|
||||||
NavigableModal
|
|
||||||
</div>
|
|
||||||
<button ion-button full (click)="submit()">Submit</button>
|
|
||||||
</ion-content>
|
|
||||||
`
|
|
||||||
})
|
|
||||||
export class NavigableModal {
|
|
||||||
|
|
||||||
constructor(public navCtrl: NavController, public viewCtrl: ViewController) {}
|
|
||||||
|
|
||||||
submit() {
|
|
||||||
this.navCtrl.push(NavigableModal2);
|
|
||||||
}
|
|
||||||
|
|
||||||
dismiss() {
|
|
||||||
this.viewCtrl.dismiss();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
template: `
|
|
||||||
<ion-header>
|
|
||||||
<ion-navbar>
|
|
||||||
<ion-title>Page Two</ion-title>
|
|
||||||
</ion-navbar>
|
|
||||||
</ion-header>
|
|
||||||
|
|
||||||
<ion-content>
|
|
||||||
<button ion-button full (click)="submit()">Submit</button>
|
|
||||||
</ion-content>
|
|
||||||
`
|
|
||||||
})
|
|
||||||
export class NavigableModal2 {
|
|
||||||
|
|
||||||
constructor(public navCtrl: NavController) {}
|
|
||||||
|
|
||||||
submit() {
|
|
||||||
this.navCtrl.pop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: `
|
template: `
|
||||||
@ -196,7 +137,12 @@ export class NavigableModal2 {
|
|||||||
export class ModalPassData {
|
export class ModalPassData {
|
||||||
data: any;
|
data: any;
|
||||||
|
|
||||||
constructor(params: NavParams, public viewCtrl: ViewController, someComponentProvider: SomeComponentProvider, someAppProvider: SomeAppProvider) {
|
constructor(
|
||||||
|
public viewCtrl: ViewController,
|
||||||
|
public toastCtrl: ToastController,
|
||||||
|
params: NavParams,
|
||||||
|
someComponentProvider: SomeComponentProvider,
|
||||||
|
someAppProvider: SomeAppProvider) {
|
||||||
this.data = {
|
this.data = {
|
||||||
userId: params.get('userId'),
|
userId: params.get('userId'),
|
||||||
name: someComponentProvider.getName()
|
name: someComponentProvider.getName()
|
||||||
@ -219,6 +165,10 @@ export class ModalPassData {
|
|||||||
|
|
||||||
ionViewDidEnter() {
|
ionViewDidEnter() {
|
||||||
console.log('ModalPassData ionViewDidEnter fired');
|
console.log('ModalPassData ionViewDidEnter fired');
|
||||||
|
this.toastCtrl.create({
|
||||||
|
message: 'test toast',
|
||||||
|
duration: 1000
|
||||||
|
}).present();
|
||||||
}
|
}
|
||||||
|
|
||||||
ionViewWillLeave() {
|
ionViewWillLeave() {
|
||||||
@ -266,7 +216,20 @@ export class ModalPassData {
|
|||||||
})
|
})
|
||||||
export class ToolbarModal {
|
export class ToolbarModal {
|
||||||
|
|
||||||
constructor(public viewCtrl: ViewController) {}
|
constructor(public viewCtrl: ViewController, public alertCtrl: AlertController) {}
|
||||||
|
|
||||||
|
ionViewDidEnter() {
|
||||||
|
let alert = this.alertCtrl.create({
|
||||||
|
title: 'Test',
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: 'Something',
|
||||||
|
role: 'cancel'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
alert.present();
|
||||||
|
}
|
||||||
|
|
||||||
dismiss() {
|
dismiss() {
|
||||||
this.viewCtrl.dismiss();
|
this.viewCtrl.dismiss();
|
||||||
@ -391,7 +354,11 @@ export class ContactUs {
|
|||||||
export class ModalFirstPage {
|
export class ModalFirstPage {
|
||||||
items: any[] = [];
|
items: any[] = [];
|
||||||
|
|
||||||
constructor(public navCtrl: NavController, public app: App, public actionSheetCtrl: ActionSheetController) {
|
constructor(
|
||||||
|
public navCtrl: NavController,
|
||||||
|
public app: App,
|
||||||
|
public actionSheetCtrl: ActionSheetController,
|
||||||
|
public alertCtrl: AlertController) {
|
||||||
for (let i = 0; i < 50; i++) {
|
for (let i = 0; i < 50; i++) {
|
||||||
this.items.push({
|
this.items.push({
|
||||||
value: (i + 1)
|
value: (i + 1)
|
||||||
@ -420,6 +387,16 @@ export class ModalFirstPage {
|
|||||||
|
|
||||||
ionViewDidEnter() {
|
ionViewDidEnter() {
|
||||||
console.log('ModalFirstPage ionViewDidEnter fired');
|
console.log('ModalFirstPage ionViewDidEnter fired');
|
||||||
|
let alert = this.alertCtrl.create({
|
||||||
|
title: 'Test',
|
||||||
|
buttons: [
|
||||||
|
{
|
||||||
|
text: 'Something',
|
||||||
|
role: 'cancel'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
alert.present();
|
||||||
}
|
}
|
||||||
|
|
||||||
openActionSheet() {
|
openActionSheet() {
|
||||||
@ -517,13 +494,13 @@ export class E2EApp {
|
|||||||
ModalSecondPage,
|
ModalSecondPage,
|
||||||
ModalWithInputs,
|
ModalWithInputs,
|
||||||
ContactUs,
|
ContactUs,
|
||||||
NavigableModal,
|
|
||||||
NavigableModal2,
|
|
||||||
ModalPassData,
|
ModalPassData,
|
||||||
ToolbarModal
|
ToolbarModal
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
IonicModule.forRoot(E2EApp)
|
IonicModule.forRoot(E2EApp, {
|
||||||
|
statusbarPadding: true
|
||||||
|
})
|
||||||
],
|
],
|
||||||
bootstrap: [IonicApp],
|
bootstrap: [IonicApp],
|
||||||
providers: [SomeAppProvider],
|
providers: [SomeAppProvider],
|
||||||
@ -534,8 +511,6 @@ export class E2EApp {
|
|||||||
ModalSecondPage,
|
ModalSecondPage,
|
||||||
ModalWithInputs,
|
ModalWithInputs,
|
||||||
ContactUs,
|
ContactUs,
|
||||||
NavigableModal,
|
|
||||||
NavigableModal2,
|
|
||||||
ModalPassData,
|
ModalPassData,
|
||||||
ToolbarModal
|
ToolbarModal
|
||||||
]
|
]
|
||||||
|
@ -12,14 +12,11 @@
|
|||||||
<p>
|
<p>
|
||||||
<button ion-button (click)="presentModal()">Present modal, pass params</button>
|
<button ion-button (click)="presentModal()">Present modal, pass params</button>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
|
||||||
<button ion-button (click)="presentNavigableModal()">Present modal, push page</button>
|
|
||||||
</p>
|
|
||||||
<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</button>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<button ion-button class="e2eOpenToolbarModal" (click)="presentToolbarModal()">Present modal w/ toolbar</button>
|
<button ion-button class="e2eOpenToolbarModal" (click)="presentToolbarModal()">Present modal w/ toolbar (and alert)</button>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<button ion-button (click)="presentModalWithInputs()">Present modal w/ inputs</button>
|
<button ion-button (click)="presentModalWithInputs()">Present modal w/ inputs</button>
|
||||||
|
Reference in New Issue
Block a user