Skip to content

Commit

Permalink
test(modal): adds e2e tests for open rc0 issues
Browse files Browse the repository at this point in the history
references #8616
references #8597
references #8573
  • Loading branch information
manucorporat committed Oct 10, 2016
1 parent 258eb72 commit c9f4a41
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 74 deletions.
115 changes: 45 additions & 70 deletions src/components/modal/test/basic/app-module.ts
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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');
});
}
Expand All @@ -89,10 +89,6 @@ export class E2EPage {
modal.present();
}

presentNavigableModal() {
this.modalCtrl.create(NavigableModal).present();
}

ionViewDidLoad() {
console.log('E2EPage ionViewDidLoad fired');
}
Expand All @@ -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: `
Expand Down Expand Up @@ -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()
Expand All @@ -219,6 +165,10 @@ export class ModalPassData {

ionViewDidEnter() {
console.log('ModalPassData ionViewDidEnter fired');
this.toastCtrl.create({
message: 'test toast',
duration: 1000
}).present();
}

ionViewWillLeave() {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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],
Expand All @@ -534,8 +511,6 @@ export class E2EApp {
ModalSecondPage,
ModalWithInputs,
ContactUs,
NavigableModal,
NavigableModal2,
ModalPassData,
ToolbarModal
]
Expand Down
5 changes: 1 addition & 4 deletions src/components/modal/test/basic/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit c9f4a41

Please sign in to comment.