mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +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 { ActionSheetController, App, Config,
|
||||
import { ActionSheetController, AlertController, App, Config,
|
||||
IonicApp, IonicModule, ModalController, NavController,
|
||||
NavParams, Platform, ViewController } from '../../../..';
|
||||
NavParams, Platform, ToastController, ViewController } from '../../../..';
|
||||
|
||||
|
||||
@Injectable()
|
||||
@ -67,7 +67,7 @@ export class E2EPage {
|
||||
console.timeEnd('modal');
|
||||
});
|
||||
modal.onDidDismiss((data: any) => {
|
||||
console.log('modal data', data);
|
||||
console.log('DID DISMISS modal data', data);
|
||||
console.timeEnd('modal');
|
||||
});
|
||||
}
|
||||
@ -89,10 +89,6 @@ export class E2EPage {
|
||||
modal.present();
|
||||
}
|
||||
|
||||
presentNavigableModal() {
|
||||
this.modalCtrl.create(NavigableModal).present();
|
||||
}
|
||||
|
||||
ionViewDidLoad() {
|
||||
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({
|
||||
template: `
|
||||
@ -196,7 +137,12 @@ export class NavigableModal2 {
|
||||
export class ModalPassData {
|
||||
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 = {
|
||||
userId: params.get('userId'),
|
||||
name: someComponentProvider.getName()
|
||||
@ -219,6 +165,10 @@ export class ModalPassData {
|
||||
|
||||
ionViewDidEnter() {
|
||||
console.log('ModalPassData ionViewDidEnter fired');
|
||||
this.toastCtrl.create({
|
||||
message: 'test toast',
|
||||
duration: 1000
|
||||
}).present();
|
||||
}
|
||||
|
||||
ionViewWillLeave() {
|
||||
@ -266,7 +216,20 @@ export class ModalPassData {
|
||||
})
|
||||
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() {
|
||||
this.viewCtrl.dismiss();
|
||||
@ -391,7 +354,11 @@ export class ContactUs {
|
||||
export class ModalFirstPage {
|
||||
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++) {
|
||||
this.items.push({
|
||||
value: (i + 1)
|
||||
@ -420,6 +387,16 @@ export class ModalFirstPage {
|
||||
|
||||
ionViewDidEnter() {
|
||||
console.log('ModalFirstPage ionViewDidEnter fired');
|
||||
let alert = this.alertCtrl.create({
|
||||
title: 'Test',
|
||||
buttons: [
|
||||
{
|
||||
text: 'Something',
|
||||
role: 'cancel'
|
||||
}
|
||||
]
|
||||
});
|
||||
alert.present();
|
||||
}
|
||||
|
||||
openActionSheet() {
|
||||
@ -517,13 +494,13 @@ export class E2EApp {
|
||||
ModalSecondPage,
|
||||
ModalWithInputs,
|
||||
ContactUs,
|
||||
NavigableModal,
|
||||
NavigableModal2,
|
||||
ModalPassData,
|
||||
ToolbarModal
|
||||
],
|
||||
imports: [
|
||||
IonicModule.forRoot(E2EApp)
|
||||
IonicModule.forRoot(E2EApp, {
|
||||
statusbarPadding: true
|
||||
})
|
||||
],
|
||||
bootstrap: [IonicApp],
|
||||
providers: [SomeAppProvider],
|
||||
@ -534,8 +511,6 @@ export class E2EApp {
|
||||
ModalSecondPage,
|
||||
ModalWithInputs,
|
||||
ContactUs,
|
||||
NavigableModal,
|
||||
NavigableModal2,
|
||||
ModalPassData,
|
||||
ToolbarModal
|
||||
]
|
||||
|
@ -12,14 +12,11 @@
|
||||
<p>
|
||||
<button ion-button (click)="presentModal()">Present modal, pass params</button>
|
||||
</p>
|
||||
<p>
|
||||
<button ion-button (click)="presentNavigableModal()">Present modal, push page</button>
|
||||
</p>
|
||||
<p>
|
||||
<button ion-button class="e2eOpenModal" (click)="presentModalChildNav()">Present modal w/ child ion-nav</button>
|
||||
</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>
|
||||
<button ion-button (click)="presentModalWithInputs()">Present modal w/ inputs</button>
|
||||
|
Reference in New Issue
Block a user