test(picker): adds push() to test hardware go back

This commit is contained in:
Manu Mtz.-Almeida
2016-12-09 10:39:40 +01:00
parent 8c297fee33
commit 0450a4e812
3 changed files with 18 additions and 4 deletions

View File

@@ -79,11 +79,12 @@ export class App {
runInDev(() => {
// During developement, navPop can be triggered by calling
// window.ClickBackButton();
// window.HWBackButton();
if (!(<any>window)['HWBackButton']) {
(<any>window)['HWBackButton'] = () => {
let p = this.goBack();
p && p.catch(() => console.debug('hardware go back cancelled'));
return p;
};
}
});
@@ -194,7 +195,7 @@ export class App {
}
/**
* @return {NavController} Retuns the root NavController
* @return {NavController} Returns the root NavController
*/
getRootNav(): NavController {
return this._rootNav;
@@ -232,6 +233,9 @@ export class App {
return portal.insertPages(-1, [enteringView], opts);
}
/**
* @private
*/
goBack(): Promise<any> {
if (this._menuCtrl && this._menuCtrl.isOpen()) {
return this._menuCtrl.close();

View File

@@ -1,5 +1,5 @@
import { Component, ViewEncapsulation, NgModule } from '@angular/core';
import { IonicApp, IonicModule, PickerController } from '../../../..';
import { IonicApp, IonicModule, NavController, PickerController } from '../../../..';
@Component({
@@ -10,7 +10,14 @@ export class E2EPage {
smoothie: string;
timer: string;
constructor(private pickerCtrl: PickerController) {}
constructor(
public navCtrl: NavController,
private pickerCtrl: PickerController
) { }
push() {
this.navCtrl.push(E2EPage);
}
twoColumns() {
let picker = this.pickerCtrl.create({

View File

@@ -2,6 +2,9 @@
<ion-navbar>
<ion-title>Picker</ion-title>
<ion-buttons end>
<button ion-button strong (click)="push()">Push</button>
</ion-buttons>
</ion-navbar>
</ion-header>