Skip to content

Commit 51a6dd6

Browse files
committed
test(angular): add new pages to navigate between lazy and standalone tests
1 parent e101f2e commit 51a6dd6

File tree

9 files changed

+243
-61
lines changed

9 files changed

+243
-61
lines changed

packages/angular/test/apps/ng19/src/app/app.module.ts

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<ion-header>
2+
<ion-toolbar>
3+
<ion-title>Test App - Angular {{ angularVersion.major }} </ion-title>
4+
</ion-toolbar>
5+
</ion-header>
6+
7+
<ion-content>
8+
<ion-list>
9+
<ion-item routerLink="/lazy">
10+
<ion-label>Go to Lazy App</ion-label>
11+
</ion-item>
12+
<ion-item routerLink="/standalone">
13+
<ion-label>Go to Standalone App</ion-label>
14+
</ion-item>
15+
</ion-list>
16+
</ion-content>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { Component, VERSION } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-landing',
5+
templateUrl: './app-landing.component.html',
6+
standalone: false
7+
})
8+
export class AppLandingComponent {
9+
angularVersion = VERSION;
10+
11+
constructor() {}
12+
13+
}
Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
1+
import { APP_ID, NgModule } from '@angular/core';
12
import { BrowserModule } from '@angular/platform-browser';
2-
import { NgModule } from '@angular/core';
33
import { RouteReuseStrategy } from '@angular/router';
4-
5-
import { AppRoutingModule } from './app-routing.module';
6-
import { AppComponent } from './app.component';
74
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
5+
import { AppComponent } from './app.component';
6+
import { AppRoutingModule } from './app-routing.module';
7+
import { AppLandingComponent } from './app-landing/app-landing.component';
88

9-
const isLazy = window.location.href.includes('lazy');
10-
11-
const imports = [
12-
BrowserModule.withServerTransition({ appId: 'serverApp' }),
13-
AppRoutingModule,
14-
];
9+
const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
1510

16-
if (isLazy) {
17-
imports.push(IonicModule.forRoot({ keyboardHeight: 12345 }));
11+
export function ionicConfigFactory(): any {
12+
const isLazy = isBrowser && window.location.href.includes('lazy');
13+
return isLazy ? { keyboardHeight: 12345 } : {};
1814
}
1915

2016
@NgModule({
21-
declarations: [
22-
AppComponent,
17+
declarations: [AppComponent, AppLandingComponent],
18+
imports: [
19+
BrowserModule,
20+
AppRoutingModule,
21+
IonicModule.forRoot(ionicConfigFactory()),
2322
],
24-
imports,
2523
providers: [
2624
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
25+
{ provide: APP_ID, useValue: 'serverApp' },
2726
],
28-
bootstrap: [AppComponent]
27+
bootstrap: [AppComponent],
2928
})
30-
export class AppModule { }
29+
export class AppModule {}
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import { Routes } from '@angular/router';
2+
import { AppLandingComponent } from './app-landing/app-landing.component';
23

34
export const routes: Routes = [
45
{
56
path: '',
67
pathMatch: 'full',
7-
/**
8-
* Omit the slash at the beginning
9-
* so query params are preserved.
10-
* https://github.com/angular/angular/issues/13315#issuecomment-427254639
11-
*/
12-
redirectTo: 'lazy'
8+
component: AppLandingComponent
139
},
14-
{ path: 'lazy', loadChildren: () => import('./lazy/app-lazy/app.module').then(m => m.AppModule) },
15-
{ path: 'standalone', loadChildren: () => import('./standalone/app-standalone/app.routes').then(m => m.routes) }
10+
{
11+
path: 'lazy',
12+
loadChildren: () => import('./lazy/app-lazy/app.module').then(m => m.AppModule)
13+
},
14+
{
15+
path: 'standalone',
16+
loadChildren: () => import('./standalone/app-standalone/app.routes').then(m => m.routes)
17+
}
1618
];

packages/angular/test/base/src/app/lazy/home-page/home-page.component.html

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,48 @@
11
<ion-header>
22
<ion-toolbar>
3+
<ion-buttons slot="start">
4+
<ion-back-button defaultHref="/"></ion-back-button>
5+
</ion-buttons>
36
<ion-title>
4-
Test App - Angular {{ angularVersion.major }}
7+
Test App - Angular {{ angularVersion.major }} - Lazy
58
</ion-title>
69
</ion-toolbar>
710
</ion-header>
811
<ion-content>
912
<ion-list>
1013
<ion-item routerLink="/lazy/alerts" [routerAnimation]="routerAnimation">
1114
<ion-label>
12-
Alerts test
15+
Alerts Test
1316
</ion-label>
1417
</ion-item>
1518
<ion-item routerLink="/lazy/inputs">
1619
<ion-label>
17-
Inputs test
20+
Inputs Test
1821
</ion-label>
1922
</ion-item>
2023
<ion-item routerLink="/lazy/form">
2124
<ion-label>
22-
Form test
25+
Form Test
2326
</ion-label>
2427
</ion-item>
2528
<ion-item routerLink="/lazy/modals">
2629
<ion-label>
27-
Modals test
30+
Modals Test
2831
</ion-label>
2932
</ion-item>
3033
<ion-item routerLink="/lazy/router-link">
3134
<ion-label>
32-
Router link test
35+
Router link Test
3336
</ion-label>
3437
</ion-item>
3538
<ion-item routerLink="/lazy/tabs">
3639
<ion-label>
37-
Tabs test
40+
Tabs Test
3841
</ion-label>
3942
</ion-item>
4043
<ion-item routerLink="/lazy/tabs-basic">
4144
<ion-label>
42-
Basic Tabs test
45+
Basic Tabs Test
4346
</ion-label>
4447
</ion-item>
4548
<ion-item routerLink="/lazy/nested-outlet/page">

packages/angular/test/base/src/app/standalone/app-standalone/app.routes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const routes: Routes = [
66
path: '',
77
component: AppComponent,
88
children: [
9+
{ path: '', loadComponent: () => import('../home-page/home-page.component').then(c => c.HomePageComponent) },
910
{ path: 'menu-controller', loadComponent: () => import('../menu-controller/menu-controller.component').then(c => c.MenuControllerComponent) },
1011
{ path: 'action-sheet-controller', loadComponent: () => import('../action-sheet-controller/action-sheet-controller.component').then(c => c.ActionSheetControllerComponent) },
1112
{ path: 'popover', loadComponent: () => import('../popover/popover.component').then(c => c.PopoverComponent) },
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
<ion-header>
2+
<ion-toolbar>
3+
<ion-buttons slot="start">
4+
<ion-back-button defaultHref="/"></ion-back-button>
5+
</ion-buttons>
6+
<ion-title>
7+
Test App - Angular {{ angularVersion.major }} - Standalone
8+
</ion-title>
9+
</ion-toolbar>
10+
</ion-header>
11+
<ion-content>
12+
<ion-list>
13+
<ion-list-header>
14+
<ion-label>Components</ion-label>
15+
</ion-list-header>
16+
<ion-item routerLink="/standalone/back-button">
17+
<ion-label>
18+
Back Button Test
19+
</ion-label>
20+
</ion-item>
21+
<ion-item routerLink="/standalone/button">
22+
<ion-label>
23+
Button Test
24+
</ion-label>
25+
</ion-item>
26+
<ion-item routerLink="/standalone/icon">
27+
<ion-label>
28+
Icon Test
29+
</ion-label>
30+
</ion-item>
31+
</ion-list>
32+
33+
<ion-list>
34+
<ion-list-header>
35+
<ion-label>Navigation</ion-label>
36+
</ion-list-header>
37+
<ion-item routerLink="/standalone/nav">
38+
<ion-label>
39+
Nav Test
40+
</ion-label>
41+
</ion-item>
42+
<ion-item routerLink="/standalone/router-link">
43+
<ion-label>
44+
Router Link Test
45+
</ion-label>
46+
</ion-item>
47+
<ion-item routerLink="/standalone/router-outlet">
48+
<ion-label>
49+
Router Outlet Test
50+
</ion-label>
51+
</ion-item>
52+
<ion-item routerLink="/standalone/tabs">
53+
<ion-label>
54+
Tabs Test
55+
</ion-label>
56+
</ion-item>
57+
<ion-item routerLink="/standalone/tabs-basic">
58+
<ion-label>
59+
Tabs Basic Test
60+
</ion-label>
61+
</ion-item>
62+
</ion-list>
63+
64+
<ion-list>
65+
<ion-list-header>
66+
<ion-label>Overlays</ion-label>
67+
</ion-list-header>
68+
<ion-item routerLink="/standalone/action-sheet-controller">
69+
<ion-label>
70+
Action Sheet Controller Test
71+
</ion-label>
72+
</ion-item>
73+
<ion-item routerLink="/standalone/menu-controller">
74+
<ion-label>
75+
Menu Controller Test
76+
</ion-label>
77+
</ion-item>
78+
<ion-item routerLink="/standalone/modal">
79+
<ion-label>
80+
Modal Test
81+
</ion-label>
82+
</ion-item>
83+
<ion-item routerLink="/standalone/overlay-controllers">
84+
<ion-label>
85+
Overlay Controllers Test
86+
</ion-label>
87+
</ion-item>
88+
<ion-item routerLink="/standalone/popover">
89+
<ion-label>
90+
Popover Test
91+
</ion-label>
92+
</ion-item>
93+
</ion-list>
94+
95+
<ion-list>
96+
<ion-list-header>
97+
<ion-label>Value Accessors</ion-label>
98+
</ion-list-header>
99+
<ion-item routerLink="/standalone/value-accessors/checkbox">
100+
<ion-label>
101+
Checkbox Test
102+
</ion-label>
103+
</ion-item>
104+
<ion-item routerLink="/standalone/value-accessors/datetime">
105+
<ion-label>
106+
Datetime Test
107+
</ion-label>
108+
</ion-item>
109+
<ion-item routerLink="/standalone/value-accessors/input">
110+
<ion-label>
111+
Input Test
112+
</ion-label>
113+
</ion-item>
114+
<ion-item routerLink="/standalone/value-accessors/radio-group">
115+
<ion-label>
116+
Radio Group Test
117+
</ion-label>
118+
</ion-item>
119+
<ion-item routerLink="/standalone/value-accessors/range">
120+
<ion-label>
121+
Range Test
122+
</ion-label>
123+
</ion-item>
124+
<ion-item routerLink="/standalone/value-accessors/searchbar">
125+
<ion-label>
126+
Searchbar Test
127+
</ion-label>
128+
</ion-item>
129+
<ion-item routerLink="/standalone/value-accessors/segment">
130+
<ion-label>
131+
Segment Test
132+
</ion-label>
133+
</ion-item>
134+
<ion-item routerLink="/standalone/value-accessors/select">
135+
<ion-label>
136+
Select Test
137+
</ion-label>
138+
</ion-item>
139+
<ion-item routerLink="/standalone/value-accessors/textarea">
140+
<ion-label>
141+
Textarea Test
142+
</ion-label>
143+
</ion-item>
144+
<ion-item routerLink="/standalone/value-accessors/toggle">
145+
<ion-label>
146+
Toggle Test
147+
</ion-label>
148+
</ion-item>
149+
</ion-list>
150+
151+
<ion-list>
152+
<ion-list-header>
153+
<ion-label>Miscellaneous</ion-label>
154+
</ion-list-header>
155+
<ion-item routerLink="/standalone/providers">
156+
<ion-label>
157+
Providers Test
158+
</ion-label>
159+
</ion-item>
160+
</ion-list>
161+
</ion-content>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Component, VERSION } from '@angular/core';
2+
import { RouterModule } from '@angular/router';
3+
import { IonBackButton, IonButtons, IonContent, IonLabel, IonList, IonListHeader, IonHeader, IonItem, IonRouterLink, IonTitle, IonToolbar } from '@ionic/angular/standalone';
4+
5+
@Component({
6+
selector: 'app-home-page',
7+
templateUrl: './home-page.component.html',
8+
standalone: true,
9+
imports: [ IonBackButton, IonButtons, IonContent, IonLabel, IonList, IonHeader, IonListHeader, IonItem, IonRouterLink, IonTitle, IonToolbar, RouterModule ]
10+
})
11+
export class HomePageComponent {
12+
angularVersion = VERSION;
13+
14+
constructor() {}
15+
}

0 commit comments

Comments
 (0)