mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
test(e2e): nav/child-navs
This commit is contained in:
@@ -1,144 +0,0 @@
|
||||
import { NgModule, Component } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { IonicApp, IonicModule, NavController } from '../../../..';
|
||||
|
||||
@Component({
|
||||
template: `<ion-nav [root]="root"></ion-nav>`,
|
||||
})
|
||||
export class E2EApp {
|
||||
root = LandingPage;
|
||||
}
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<ion-header>
|
||||
<ion-navbar>
|
||||
<ion-title>
|
||||
Landing Page Comp
|
||||
</ion-title>
|
||||
</ion-navbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<button ion-button color="primary" (click)="goToPage()" class="e2eChildNavsNested">
|
||||
Nested Children Test
|
||||
</button>
|
||||
</ion-content>
|
||||
`
|
||||
})
|
||||
export class LandingPage {
|
||||
|
||||
constructor(public navCtrl: NavController) {}
|
||||
|
||||
goToPage() {
|
||||
this.navCtrl.push(FirstPage);
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<ion-header>
|
||||
<ion-navbar>
|
||||
<ion-title>
|
||||
First Page Comp
|
||||
</ion-title>
|
||||
</ion-navbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<h3>Sub Header First Page</h3>
|
||||
<ion-nav [root]="root"></ion-nav>
|
||||
</ion-content>
|
||||
`
|
||||
})
|
||||
export class FirstPage {
|
||||
root = SecondPage;
|
||||
}
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<ion-header>
|
||||
<ion-navbar>
|
||||
<ion-title>
|
||||
Second Page Comp
|
||||
</ion-title>
|
||||
</ion-navbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<h3>Sub Header Second Page</h3>
|
||||
<ion-nav [root]="root"></ion-nav>
|
||||
</ion-content>
|
||||
`
|
||||
})
|
||||
export class SecondPage {
|
||||
root = ThirdPage;
|
||||
}
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<ion-header>
|
||||
<ion-navbar>
|
||||
<ion-title>
|
||||
Third Page Comp
|
||||
</ion-title>
|
||||
</ion-navbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<h3>Sub Header Third Page</h3>
|
||||
<ion-nav [root]="root"></ion-nav>
|
||||
</ion-content>
|
||||
`
|
||||
})
|
||||
export class ThirdPage {
|
||||
root = FourthPage;
|
||||
}
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<ion-content>
|
||||
<ion-list>
|
||||
<ion-item *ngFor="let item of items">
|
||||
{{item}}
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
`
|
||||
})
|
||||
export class FourthPage {
|
||||
items: string[];
|
||||
|
||||
ionViewWillEnter() {
|
||||
let items: string[] = [];
|
||||
for ( let i = 0 ; i < 500; i++ ) {
|
||||
items.push(`Item ${(i + 1)}`);
|
||||
}
|
||||
this.items = items;
|
||||
}
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
E2EApp,
|
||||
LandingPage,
|
||||
FirstPage,
|
||||
SecondPage,
|
||||
ThirdPage,
|
||||
FourthPage
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
IonicModule.forRoot(E2EApp)
|
||||
],
|
||||
bootstrap: [IonicApp],
|
||||
entryComponents: [
|
||||
E2EApp,
|
||||
LandingPage,
|
||||
FirstPage,
|
||||
SecondPage,
|
||||
ThirdPage,
|
||||
FourthPage
|
||||
]
|
||||
})
|
||||
export class AppModule {}
|
||||
8
src/components/nav/test/child-navs/app/app.component.ts
Normal file
8
src/components/nav/test/child-navs/app/app.component.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
template: `<ion-nav [root]="root"></ion-nav>`,
|
||||
})
|
||||
export class E2EApp {
|
||||
root = 'LandingPage';
|
||||
}
|
||||
28
src/components/nav/test/child-navs/app/app.module.ts
Normal file
28
src/components/nav/test/child-navs/app/app.module.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { NgModule, Component } from '@angular/core';
|
||||
import { BrowserModule } from '@angular/platform-browser';
|
||||
import { IonicApp, IonicModule } from '../../../../..';
|
||||
|
||||
import { E2EApp } from './app.component';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
E2EApp,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
IonicModule.forRoot(E2EApp, {}, {
|
||||
links: [
|
||||
{ loadChildren: '../pages/landing-page/landing-page.module#LandingPageModule', name: 'LandingPage' },
|
||||
{ loadChildren: '../pages/first-page/first-page.module#FirstPageModule', name: 'FirstPage' },
|
||||
{ loadChildren: '../pages/second-page/second-page.module#SecondPageModule', name: 'SecondPage' },
|
||||
{ loadChildren: '../pages/third-page/third-page.module#ThirdPageModule', name: 'ThirdPage' },
|
||||
{ loadChildren: '../pages/fourth-page/fourth-page.module#FourthPageModule', name: 'FourthPage' },
|
||||
]
|
||||
})
|
||||
],
|
||||
bootstrap: [IonicApp],
|
||||
entryComponents: [
|
||||
E2EApp,
|
||||
]
|
||||
})
|
||||
export class AppModule {}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { DeepLinkModule } from '../../../../../..';
|
||||
|
||||
import { FirstPage } from './first-page';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
FirstPage,
|
||||
],
|
||||
imports: [
|
||||
DeepLinkModule.forChild(FirstPage)
|
||||
],
|
||||
entryComponents: [
|
||||
FirstPage,
|
||||
]
|
||||
})
|
||||
export class FirstPageModule {}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<ion-header>
|
||||
<ion-navbar>
|
||||
<ion-title>
|
||||
First Page Comp
|
||||
</ion-title>
|
||||
</ion-navbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<h3>Sub Header First Page</h3>
|
||||
<ion-nav [root]="root"></ion-nav>
|
||||
</ion-content>
|
||||
`
|
||||
})
|
||||
export class FirstPage {
|
||||
root = 'SecondPage';
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { DeepLinkModule } from '../../../../../..';
|
||||
|
||||
import { FourthPage } from './fourth-page';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
FourthPage,
|
||||
],
|
||||
imports: [
|
||||
DeepLinkModule.forChild(FourthPage)
|
||||
],
|
||||
entryComponents: [
|
||||
FourthPage,
|
||||
]
|
||||
})
|
||||
export class FourthPageModule {}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<ion-content>
|
||||
<ion-list>
|
||||
<ion-item *ngFor="let item of items">
|
||||
{{item}}
|
||||
</ion-item>
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
`
|
||||
})
|
||||
export class FourthPage {
|
||||
items: string[];
|
||||
|
||||
ionViewWillEnter() {
|
||||
let items: string[] = [];
|
||||
for ( let i = 0 ; i < 500; i++ ) {
|
||||
items.push(`Item ${(i + 1)}`);
|
||||
}
|
||||
this.items = items;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { DeepLinkModule } from '../../../../../..';
|
||||
|
||||
import { LandingPage } from './landing-page';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
LandingPage,
|
||||
],
|
||||
imports: [
|
||||
DeepLinkModule.forChild(LandingPage)
|
||||
],
|
||||
entryComponents: [
|
||||
LandingPage,
|
||||
]
|
||||
})
|
||||
export class LandingPageModule {}
|
||||
@@ -0,0 +1,28 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { NavController } from '../../../../../..';
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<ion-header>
|
||||
<ion-navbar>
|
||||
<ion-title>
|
||||
Landing Page Comp
|
||||
</ion-title>
|
||||
</ion-navbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<button ion-button color="primary" (click)="goToPage()" class="e2eChildNavsNested">
|
||||
Nested Children Test
|
||||
</button>
|
||||
</ion-content>
|
||||
`
|
||||
})
|
||||
export class LandingPage {
|
||||
|
||||
constructor(public navCtrl: NavController) {}
|
||||
|
||||
goToPage() {
|
||||
this.navCtrl.push('FirstPage');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { DeepLinkModule } from '../../../../../..';
|
||||
|
||||
import { SecondPage } from './second-page';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
SecondPage,
|
||||
],
|
||||
imports: [
|
||||
DeepLinkModule.forChild(SecondPage)
|
||||
],
|
||||
entryComponents: [
|
||||
SecondPage,
|
||||
]
|
||||
})
|
||||
export class SecondPageModule {}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<ion-header>
|
||||
<ion-navbar>
|
||||
<ion-title>
|
||||
Second Page Comp
|
||||
</ion-title>
|
||||
</ion-navbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<h3>Sub Header Second Page</h3>
|
||||
<ion-nav [root]="root"></ion-nav>
|
||||
</ion-content>
|
||||
`
|
||||
})
|
||||
export class SecondPage {
|
||||
root = 'ThirdPage';
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { DeepLinkModule } from '../../../../../..';
|
||||
|
||||
import { ThirdPage } from './third-page';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
ThirdPage,
|
||||
],
|
||||
imports: [
|
||||
DeepLinkModule.forChild(ThirdPage)
|
||||
],
|
||||
entryComponents: [
|
||||
ThirdPage,
|
||||
]
|
||||
})
|
||||
export class ThirdPageModule {}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
<ion-header>
|
||||
<ion-navbar>
|
||||
<ion-title>
|
||||
Third Page Comp
|
||||
</ion-title>
|
||||
</ion-navbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
<h3>Sub Header Third Page</h3>
|
||||
<ion-nav [root]="root"></ion-nav>
|
||||
</ion-content>
|
||||
`
|
||||
})
|
||||
export class ThirdPage {
|
||||
root = 'FourthPage';
|
||||
}
|
||||
Reference in New Issue
Block a user