Skip to content

Commit 3cb9e13

Browse files
committed
test(angular): add split pane test
1 parent 51a6dd6 commit 3cb9e13

File tree

7 files changed

+134
-0
lines changed

7 files changed

+134
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ export const routes: Routes = [
1919
{ path: 'overlay-controllers', loadComponent: () => import('../overlay-controllers/overlay-controllers.component').then(c => c.OverlayControllersComponent) },
2020
{ path: 'button', loadComponent: () => import('../button/button.component').then(c => c.ButtonComponent) },
2121
{ path: 'icon', loadComponent: () => import('../icon/icon.component').then(c => c.IconComponent) },
22+
{ path: 'split-pane', redirectTo: '/standalone/split-pane/inbox', pathMatch: 'full' },
23+
{
24+
path: 'split-pane',
25+
loadComponent: () => import('../split-pane/split-pane.component').then(c => c.SplitPaneComponent),
26+
children: [
27+
{ path: ':id', loadComponent: () => import('../split-pane/split-pane-page.component').then(c => c.SplitPanePageComponent) },
28+
]
29+
},
2230
{ path: 'tabs', redirectTo: '/standalone/tabs/tab-one', pathMatch: 'full' },
2331
{
2432
path: 'tabs',

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@
4949
Router Outlet Test
5050
</ion-label>
5151
</ion-item>
52+
<ion-item routerLink="/standalone/split-pane">
53+
<ion-label>
54+
Split Pane Test
55+
</ion-label>
56+
</ion-item>
5257
<ion-item routerLink="/standalone/tabs">
5358
<ion-label>
5459
Tabs Test
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<ion-header [translucent]="true">
2+
<ion-toolbar>
3+
<ion-buttons slot="start">
4+
<ion-menu-button></ion-menu-button>
5+
</ion-buttons>
6+
<ion-title>{{ folder }}</ion-title>
7+
</ion-toolbar>
8+
</ion-header>
9+
10+
<ion-content [fullscreen]="true">
11+
<ion-header collapse="condense">
12+
<ion-toolbar>
13+
<ion-title size="large">{{ folder }}</ion-title>
14+
</ion-toolbar>
15+
</ion-header>
16+
17+
<div id="container">
18+
<ion-button (click)="onClick('one')">Button One</ion-button>
19+
<ion-button (click)="onClick('two')">Button Two</ion-button>
20+
<ion-button (click)="onClick('three')">Button Three</ion-button>
21+
<ion-button (click)="onClick('four')">Button Four</ion-button>
22+
</div>
23+
</ion-content>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { Component, inject, OnInit } from '@angular/core';
2+
import { ActivatedRoute } from '@angular/router';
3+
import { IonButton, IonButtons, IonContent, IonHeader, IonMenuButton, IonTitle, IonToolbar } from '@ionic/angular/standalone';
4+
5+
@Component({
6+
selector: 'app-split-pane-page',
7+
templateUrl: './split-pane-page.component.html',
8+
imports: [ IonButton, IonButtons, IonContent, IonHeader, IonMenuButton, IonTitle, IonToolbar ],
9+
standalone: true,
10+
})
11+
export class SplitPanePageComponent implements OnInit {
12+
public folder!: string;
13+
private activatedRoute = inject(ActivatedRoute);
14+
15+
constructor() {}
16+
17+
ngOnInit() {
18+
this.folder = this.activatedRoute.snapshot.paramMap.get('id') as string;
19+
}
20+
21+
onClick(val: string) {
22+
console.log(val);
23+
}
24+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ion-item.selected {
2+
--background: rgb(var(--ion-color-primary-rgb, 0, 84, 233), 0.14);
3+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<ion-split-pane contentId="main-content" when="xs">
2+
<ion-menu contentId="main-content" type="overlay">
3+
<ion-content>
4+
<ion-list id="inbox-list">
5+
<ion-list-header>Inbox</ion-list-header>
6+
7+
<ion-menu-toggle auto-hide="false" *ngFor="let p of appPages; let i = index">
8+
<ion-item
9+
routerDirection="root"
10+
[routerLink]="[p.url]"
11+
lines="none"
12+
detail="false"
13+
routerLinkActive="selected"
14+
>
15+
<ion-label>{{ p.title }}</ion-label>
16+
</ion-item>
17+
</ion-menu-toggle>
18+
</ion-list>
19+
</ion-content>
20+
</ion-menu>
21+
<ion-router-outlet id="main-content"></ion-router-outlet>
22+
</ion-split-pane>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import { CommonModule } from '@angular/common';
2+
import { Component } from '@angular/core';
3+
import { RouterLink, RouterLinkActive } from '@angular/router';
4+
import {
5+
IonContent,
6+
IonItem,
7+
IonLabel,
8+
IonList,
9+
IonListHeader,
10+
IonMenu,
11+
IonMenuToggle,
12+
IonRouterLink,
13+
IonRouterOutlet,
14+
IonSplitPane
15+
} from '@ionic/angular/standalone';
16+
17+
@Component({
18+
selector: 'app-split-pane',
19+
templateUrl: 'split-pane.component.html',
20+
styleUrl: 'split-pane.component.css',
21+
standalone: true,
22+
imports: [
23+
CommonModule,
24+
IonContent,
25+
IonItem,
26+
IonLabel,
27+
IonList,
28+
IonListHeader,
29+
IonMenu,
30+
IonMenuToggle,
31+
IonRouterLink,
32+
IonRouterOutlet,
33+
IonSplitPane,
34+
RouterLink,
35+
RouterLinkActive,
36+
],
37+
})
38+
export class SplitPaneComponent {
39+
public appPages = [
40+
{ title: 'Inbox', url: '/standalone/split-pane/inbox' },
41+
{ title: 'Outbox', url: '/standalone/split-pane/outbox' },
42+
{ title: 'Favorites', url: '/standalone/split-pane/favorites' },
43+
{ title: 'Archived', url: '/standalone/split-pane/archived' },
44+
{ title: 'Trash', url: '/standalone/split-pane/trash' },
45+
{ title: 'Spam', url: '/standalone/split-pane/spam'}
46+
];
47+
48+
constructor() { }
49+
}

0 commit comments

Comments
 (0)