mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
test(e2e) loading/tabs
This commit is contained in:
@ -1,93 +0,0 @@
|
|||||||
import { Component, NgModule } from '@angular/core';
|
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
|
||||||
import { IonicApp, IonicModule, LoadingController, NavController } from '../../../..';
|
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
templateUrl: 'main.html'
|
|
||||||
})
|
|
||||||
export class E2EPage {
|
|
||||||
constructor(public loadingCtrl: LoadingController, public navCtrl: NavController) {}
|
|
||||||
|
|
||||||
presentLoading() {
|
|
||||||
let loading = this.loadingCtrl.create({
|
|
||||||
spinner: 'hide',
|
|
||||||
content: 'Loading...',
|
|
||||||
duration: 1000
|
|
||||||
});
|
|
||||||
|
|
||||||
loading.present();
|
|
||||||
}
|
|
||||||
|
|
||||||
presentLoadingNav() {
|
|
||||||
let loading = this.loadingCtrl.create({
|
|
||||||
content: 'Please wait...',
|
|
||||||
});
|
|
||||||
|
|
||||||
loading.present();
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
this.navCtrl.push(Page2);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
loading.dismiss();
|
|
||||||
}, 1000);
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
template: `
|
|
||||||
<ion-header>
|
|
||||||
<ion-navbar>
|
|
||||||
<ion-title>Page 2</ion-title>
|
|
||||||
</ion-navbar>
|
|
||||||
</ion-header>
|
|
||||||
<ion-content padding>Some content</ion-content>
|
|
||||||
`
|
|
||||||
})
|
|
||||||
export class Page2 {}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
template: `
|
|
||||||
<ion-tabs>
|
|
||||||
<ion-tab tabTitle="Plain List" tabIcon="star" [root]="root1"></ion-tab>
|
|
||||||
<ion-tab tabTitle="Schedule" tabIcon="globe" [root]="root2"></ion-tab>
|
|
||||||
<ion-tab tabTitle="Stopwatch" tabIcon="stopwatch" [root]="root3"></ion-tab>
|
|
||||||
</ion-tabs>
|
|
||||||
`
|
|
||||||
})
|
|
||||||
export class TabsPage {
|
|
||||||
root1 = E2EPage;
|
|
||||||
root2 = Page2;
|
|
||||||
root3 = E2EPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
template: '<ion-nav [root]="root"></ion-nav>'
|
|
||||||
})
|
|
||||||
export class E2EApp {
|
|
||||||
root = TabsPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
declarations: [
|
|
||||||
E2EApp,
|
|
||||||
E2EPage,
|
|
||||||
TabsPage,
|
|
||||||
Page2
|
|
||||||
],
|
|
||||||
imports: [
|
|
||||||
BrowserModule,
|
|
||||||
IonicModule.forRoot(E2EApp)
|
|
||||||
],
|
|
||||||
bootstrap: [IonicApp],
|
|
||||||
entryComponents: [
|
|
||||||
E2EApp,
|
|
||||||
E2EPage,
|
|
||||||
TabsPage,
|
|
||||||
Page2
|
|
||||||
]
|
|
||||||
})
|
|
||||||
export class AppModule {}
|
|
8
src/components/loading/test/tabs/app/app.component.ts
Normal file
8
src/components/loading/test/tabs/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 = 'TabsPage';
|
||||||
|
}
|
26
src/components/loading/test/tabs/app/app.module.ts
Normal file
26
src/components/loading/test/tabs/app/app.module.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import { NgModule } 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/main/main.module#E2EPageModule', name: 'E2EPage' },
|
||||||
|
{ loadChildren: '../pages/page2/page2.module#Page2Module', name: 'Page2' },
|
||||||
|
{ loadChildren: '../pages/tabs/tabs.module#TabsPageModule', name: 'TabsPage' }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
],
|
||||||
|
bootstrap: [IonicApp],
|
||||||
|
entryComponents: [
|
||||||
|
E2EApp
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class AppModule {}
|
17
src/components/loading/test/tabs/pages/main/main.module.ts
Normal file
17
src/components/loading/test/tabs/pages/main/main.module.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { DeepLinkModule } from '../../../../../..';
|
||||||
|
|
||||||
|
import { E2EPage } from './main';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
E2EPage,
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
DeepLinkModule.forChild(E2EPage)
|
||||||
|
],
|
||||||
|
entryComponents: [
|
||||||
|
E2EPage,
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class E2EPageModule {}
|
36
src/components/loading/test/tabs/pages/main/main.ts
Normal file
36
src/components/loading/test/tabs/pages/main/main.ts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { LoadingController, NavController } from '../../../../../..';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
templateUrl: 'main.html'
|
||||||
|
})
|
||||||
|
export class E2EPage {
|
||||||
|
constructor(public loadingCtrl: LoadingController, public navCtrl: NavController) {}
|
||||||
|
|
||||||
|
presentLoading() {
|
||||||
|
let loading = this.loadingCtrl.create({
|
||||||
|
spinner: 'hide',
|
||||||
|
content: 'Loading...',
|
||||||
|
duration: 1000
|
||||||
|
});
|
||||||
|
|
||||||
|
loading.present();
|
||||||
|
}
|
||||||
|
|
||||||
|
presentLoadingNav() {
|
||||||
|
let loading = this.loadingCtrl.create({
|
||||||
|
content: 'Please wait...',
|
||||||
|
});
|
||||||
|
|
||||||
|
loading.present();
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
this.navCtrl.push('Page2');
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
loading.dismiss();
|
||||||
|
}, 1000);
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
17
src/components/loading/test/tabs/pages/page2/page2.module.ts
Normal file
17
src/components/loading/test/tabs/pages/page2/page2.module.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { DeepLinkModule } from '../../../../../..';
|
||||||
|
|
||||||
|
import { Page2 } from './page2';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
Page2,
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
DeepLinkModule.forChild(Page2)
|
||||||
|
],
|
||||||
|
entryComponents: [
|
||||||
|
Page2,
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class Page2Module {}
|
13
src/components/loading/test/tabs/pages/page2/page2.ts
Normal file
13
src/components/loading/test/tabs/pages/page2/page2.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
template: `
|
||||||
|
<ion-header>
|
||||||
|
<ion-navbar>
|
||||||
|
<ion-title>Page 2</ion-title>
|
||||||
|
</ion-navbar>
|
||||||
|
</ion-header>
|
||||||
|
<ion-content padding>Some content</ion-content>
|
||||||
|
`
|
||||||
|
})
|
||||||
|
export class Page2 {}
|
17
src/components/loading/test/tabs/pages/tabs/tabs.module.ts
Normal file
17
src/components/loading/test/tabs/pages/tabs/tabs.module.ts
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { DeepLinkModule } from '../../../../../..';
|
||||||
|
|
||||||
|
import { TabsPage } from './tabs';
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
TabsPage,
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
DeepLinkModule.forChild(TabsPage)
|
||||||
|
],
|
||||||
|
entryComponents: [
|
||||||
|
TabsPage,
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class TabsPageModule {}
|
16
src/components/loading/test/tabs/pages/tabs/tabs.ts
Normal file
16
src/components/loading/test/tabs/pages/tabs/tabs.ts
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
template: `
|
||||||
|
<ion-tabs>
|
||||||
|
<ion-tab tabTitle="Plain List" tabIcon="star" [root]="root1"></ion-tab>
|
||||||
|
<ion-tab tabTitle="Schedule" tabIcon="globe" [root]="root2"></ion-tab>
|
||||||
|
<ion-tab tabTitle="Stopwatch" tabIcon="stopwatch" [root]="root3"></ion-tab>
|
||||||
|
</ion-tabs>
|
||||||
|
`
|
||||||
|
})
|
||||||
|
export class TabsPage {
|
||||||
|
root1 = 'E2EPage';
|
||||||
|
root2 = 'Page2';
|
||||||
|
root3 = 'E2EPage';
|
||||||
|
}
|
Reference in New Issue
Block a user