test(nav): clean up NavController tests

This commit is contained in:
Adam Bradley
2016-07-15 15:55:49 -05:00
parent 0a7d865975
commit 0386476879
13 changed files with 44 additions and 48 deletions

View File

@ -8,7 +8,6 @@ import { Form } from '../../util/form';
import { Item } from '../item/item';
import { merge, isBlank, isPresent, isTrueProperty, isArray, isString } from '../../util/util';
import { dateValueRange, renderDateTime, renderTextFormat, convertFormatToKey, getValueFromFormat, parseTemplate, parseDate, updateDate, DateTimeData, convertDataToISO, daysInMonth, dateSortValue, dateDataSortValue, LocaleData } from '../../util/datetime-util';
import { NavController } from '../nav/nav-controller';
export const DATETIME_VALUE_ACCESSOR = new Provider(
NG_VALUE_ACCESSOR, {useExisting: forwardRef(() => DateTime), multi: true});

View File

@ -7,7 +7,7 @@ import {ionicBootstrap, InfiniteScroll, NavController} from '../../../../../src'
})
class E2EPage1 {
@ViewChild(InfiniteScroll) infiniteScroll: InfiniteScroll;
items = [];
items: number[] = [];
enabled: boolean = true;
constructor(private nav: NavController) {
@ -68,7 +68,7 @@ function getAsyncData(): Promise<any[]> {
return new Promise(resolve => {
setTimeout(() => {
let data = [];
let data: number[] = [];
for (var i = 0; i < 30; i++) {
data.push(i);
}

View File

@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {ionicBootstrap, NavController, NavParams} from '../../../../../src';
import { Component } from '@angular/core';
import { ionicBootstrap, NavController, NavParams } from '../../../../../src';
@Component({

View File

@ -1,6 +1,6 @@
import { Component, Injectable } from '@angular/core';
import { ActionSheetController, Config, ionicBootstrap, ModalController, NavController, NavParams, PageTransition, Platform, TransitionOptions, ViewController } from '../../../../../src';
import { ActionSheetController, App, Config, ionicBootstrap, ModalController, NavController, NavParams, PageTransition, Platform, TransitionOptions, ViewController } from '../../../../../src';
@Injectable()
@ -117,11 +117,11 @@ class E2EPage {
`
})
class NavigableModal {
constructor(private navController:NavController) {
constructor(private nav: NavController) {
}
submit(){
this.navController.push(NavigableModal2);
this.nav.push(NavigableModal2);
}
}
@ -376,7 +376,7 @@ class ContactUs {
class ModalFirstPage {
private items:any[];
constructor(private nav: NavController, private actionSheetCtrl: ActionSheetController) {
constructor(private nav: NavController, private app: App, private actionSheetCtrl: ActionSheetController) {
this.items = [];
for ( let i = 0; i < 50; i++ ){
this.items.push({
@ -393,7 +393,7 @@ class ModalFirstPage {
}
dismiss() {
this.nav.rootNav.pop();
this.app.getRootNav().pop();
}
ionViewLoaded(){
@ -430,8 +430,8 @@ class ModalFirstPage {
// overlays are added and removed from the root navigation
// find the root navigation, and pop this alert
// when the alert is done animating out, then pop off the modal
this.nav.rootNav.pop().then(() => {
this.nav.rootNav.pop();
this.app.getRootNav().pop().then(() => {
this.app.getRootNav().pop();
});
// by default an alert will dismiss itself

View File

@ -1,6 +1,6 @@
import { Component, ViewChild } from '@angular/core';
import { NavController, AlertController, Content } from '../../../../../src';
import { ionicBootstrap } from '../../../../../src';
import { ionicBootstrap, App } from '../../../../../src';
import { NavParams, ViewController } from '../../../../../src';;
@ -148,6 +148,7 @@ class FirstPage {
class FullPage {
constructor(
private nav: NavController,
private app: App,
private alertCtrl: AlertController,
private params: NavParams
) {}
@ -184,8 +185,8 @@ class FullPage {
// overlays are added and removed from the root navigation
// ensure you using the root navigation, and pop this alert
// when the alert is done animating out, then pop off the active page
this.nav.rootNav.pop().then(() => {
this.nav.rootNav.pop();
this.app.getRootNav().pop().then(() => {
this.app.getRootNav().pop();
});
// by default an alert will dismiss itself

View File

@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {ionicBootstrap, NavController} from '../../../../../src';
import { Component} from '@angular/core';
import { ionicBootstrap, NavController } from '../../../../../src';
@Component({
template: `<ion-nav [root]="root"></ion-nav>`,
@ -29,11 +29,11 @@ ionicBootstrap(E2EApp);
})
class LandingPage{
constructor(private _navController: NavController){
constructor(private nav: NavController){
}
goToPage(){
this._navController.push(FirstPage);
this.nav.push(FirstPage);
}
}

View File

@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {ionicBootstrap, NavController} from '../../../../../src';
import { Component} from '@angular/core';
import { ionicBootstrap, NavController } from '../../../../../src';
@Component({

View File

@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {ionicBootstrap, NavController} from '../../../../../src';
import { Component} from '@angular/core';
import { ionicBootstrap, NavController } from '../../../../../src';
let delay = 100;
@ -16,7 +16,7 @@ let count = 0;
`
})
class Page1 {
tmr;
tmr: number;
constructor(private nav: NavController) {}
@ -50,7 +50,7 @@ class Page1 {
`
})
class Page2 {
tmr;
tmr: number;
constructor(private nav: NavController) {}

View File

@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {ionicBootstrap, NavController} from '../../../../../src';
import { Component} from '@angular/core';
import { ionicBootstrap, NavController } from '../../../../../src';
@Component({
@ -8,7 +8,7 @@ import {ionicBootstrap, NavController} from '../../../../../src';
class IntroPage {
continueText: string = "Skip";
startingIndex: number = 1;
mySlideOptions;
mySlideOptions: any;
showSlide: boolean = true;
constructor(private nav: NavController) {
@ -20,16 +20,16 @@ class IntroPage {
};
}
onSlideChanged(slider) {
console.log("Slide changed", slider);
onSlideChanged(slider: any) {
console.log('Slide changed', slider);
}
onSlideChangeStart(slider) {
console.log("Slide change start", slider);
slider.isEnd ? this.continueText = "Continue" : this.continueText = "Skip";
onSlideChangeStart(slider: any) {
console.log('Slide change start', slider);
slider.isEnd ? this.continueText = 'Continue' : this.continueText = "Skip";
}
onSlideMove(slider) {
onSlideMove(slider: any) {
console.log("Slide move", slider);
}

View File

@ -1,6 +1,6 @@
import { Component, ViewChild } from '@angular/core';
import { ionicBootstrap, NavController, NavParams, ModalController, ViewController, Tabs, Tab } from '../../../../../src';
import { App, ionicBootstrap, NavController, NavParams, ModalController, ViewController, Tabs, Tab } from '../../../../../src';
@Component({
@ -92,7 +92,7 @@ class TabsPage {
class Tab1Page1 {
userId: string;
constructor(private nav: NavController, private tabs: Tabs, private params: NavParams) {
constructor(private nav: NavController, private app: App, private tabs: Tabs, private params: NavParams) {
this.userId = params.get('userId');
}
@ -102,7 +102,7 @@ class Tab1Page1 {
goBack() {
console.log('go back begin');
this.nav.pop().then((val) => {
this.nav.pop().then((val: any) => {
console.log('go back completed', val);
});;
}
@ -112,7 +112,7 @@ class Tab1Page1 {
}
logout() {
this.nav.rootNav.setRoot(SignIn, null, { animate: true, direction: 'back' });
this.app.getRootNav().setRoot(SignIn, null, { animate: true, direction: 'back' });
}
ionViewWillEnter() {
@ -323,10 +323,8 @@ class Tab3Page1 {
@Component({
template: '<ion-nav [root]="root" swipeBackEnabled="false"></ion-nav>'
template: '<ion-nav swipeBackEnabled="false"></ion-nav>'
})
class E2EApp {
root = SignIn;
}
class E2EApp {}
ionicBootstrap(E2EApp);

View File

@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {ionicBootstrap, NavController, App, AlertController, ModalController, ViewController, Tab, Tabs} from '../../../../../src';
import { Component} from '@angular/core';
import { ionicBootstrap, App, AlertController, ModalController, ViewController, Tab, Tabs } from '../../../../../src';
//
// Modal

View File

@ -1,5 +1,5 @@
import {Component} from '@angular/core';
import {ionicBootstrap, NavController, App, Alert, Modal, ViewController, Tab, Tabs} from '../../../../../src';
import { Component } from '@angular/core';
import { ionicBootstrap, NavController, App, Alert, Modal, ViewController, Tab, Tabs } from '../../../../../src';
//

View File

@ -4,7 +4,6 @@ import { NgIf } from '@angular/common';
import { Animation } from '../../animations/animation';
import { Config } from '../../config/config';
import { isPresent } from '../../util/util';
import { NavController } from '../nav/nav-controller';
import { NavParams } from '../nav/nav-params';
import { Transition, TransitionOptions } from '../../transitions/transition';
import { ViewController } from '../nav/view-controller';
@ -44,7 +43,6 @@ export class ToastCmp implements AfterViewInit {
private id: number;
constructor(
private _nav: NavController,
private _viewCtrl: ViewController,
private _config: Config,
private _elementRef: ElementRef,