mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
test(menu): adds menu+alert tests
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user