test(menu): adds menu+alert tests

This commit is contained in:
Manu Mtz.-Almeida
2016-06-24 20:03:15 +02:00
parent ae86ab8b81
commit 614a49240b
5 changed files with 33 additions and 11 deletions

View File

@@ -10,8 +10,8 @@ class Page1 {
presentAlert() {
let alert = Alert.create({
title: "New Friend!",
message: "Your friend, Obi wan Kenobi, just accepted your friend request!",
title: 'New Friend!',
message: 'Your friend, Obi wan Kenobi, just accepted your friend request!',
cssClass: 'my-alert',
buttons: ['Ok']
});
@@ -42,7 +42,7 @@ class Page2 {
templateUrl: 'main.html'
})
class E2EPage {
rootPage;
rootPage: any;
changeDetectionCount: number = 0;
pages: Array<{title: string, component: any}>;
@ViewChild(Nav) nav: Nav;
@@ -57,7 +57,7 @@ class E2EPage {
];
}
openPage(page) {
openPage(page: any) {
// Reset the content nav to have just this page
// we wouldn't want the back button to show in this scenario
this.nav.setRoot(page.component).then(() => {
@@ -67,15 +67,15 @@ class E2EPage {
});
}
onDrag(ev) {
onDrag(ev: any) {
console.log('Menu is being dragged', ev);
}
onOpen(ev) {
onOpen(ev: any) {
console.log('Menu is open', ev);
}
onClose(ev) {
onClose(ev: any) {
console.log('Menu is closed', ev);
}

View File

@@ -1,5 +1,5 @@
import {Component, ViewChild} from '@angular/core';
import {ionicBootstrap, Nav} from '../../../../../src';
import {ionicBootstrap, Nav, Alert} from '../../../../../src';
@Component({templateUrl: 'page1.html'})
@@ -14,7 +14,7 @@ class E2EApp {
rootView = Page1;
openPage(menu, page) {
openPage(menu: any, page: any) {
// close the menu when clicking a link from the menu
menu.close();
@@ -22,6 +22,14 @@ class E2EApp {
// we wouldn't want the back button to show in this scenario
this.nav.setRoot(page.component);
}
showAlert() {
let alert = Alert.create({
title: 'Alert example',
buttons: ['Ok']
});
this.nav.present(alert);
}
}
ionicBootstrap(E2EApp);

View File

@@ -11,6 +11,9 @@
<button ion-item menuToggle="myMenuId" detail-none>
Close Left Menu
</button>
<button ion-item detail-none (click)="showAlert()">
Show alert
</button>
</ion-list>
</ion-content>

View File

@@ -1,5 +1,5 @@
import {Component, ViewChild} from '@angular/core';
import {ionicBootstrap, Nav} from '../../../../../src';
import {ionicBootstrap, Nav, Alert} from '../../../../../src';
@Component({templateUrl: 'page1.html'})
@@ -14,7 +14,7 @@ class E2EApp {
rootView = Page1;
openPage(menu, page) {
openPage(menu: any, page: any) {
// close the menu when clicking a link from the menu
menu.close();
@@ -22,6 +22,14 @@ class E2EApp {
// we wouldn't want the back button to show in this scenario
this.nav.setRoot(page.component);
}
showAlert() {
let alert = Alert.create({
title: 'Alert example',
buttons: ['Ok']
});
this.nav.present(alert);
}
}
ionicBootstrap(E2EApp);

View File

@@ -11,6 +11,9 @@
<button ion-item menuToggle="left" detail-none>
Close Left Menu
</button>
<button ion-item detail-none (click)="showAlert()">
Show alert
</button>
</ion-list>
</ion-content>