Skip to content

Commit b9364eb

Browse files
ADjenkovADjenkov
ADjenkov
authored and
ADjenkov
committed
tests(e2e): test nested primary p-r-o navigation
1 parent fbd4960 commit b9364eb

11 files changed

+36
-21
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<GridLayout rows="auto">
2+
<Label text="Nested About Component"></Label>
3+
</GridLayout>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Component } from "@angular/core";
2+
3+
@Component({
4+
moduleId: module.id,
5+
selector: "about-nested-page",
6+
templateUrl: "./about-nested.component.html"
7+
})
8+
export class AboutNestedComponent {
9+
}

e2e/nested-router-tab-view/app/about/about.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@
44

55
<GridLayout rows="auto, *">
66
<Button text="Back(ActivatedRoute)" automationText="Back(ActivatedRoute)" (tap)="backActivatedRoute()"></Button>
7+
<GridLayout row="1">
8+
<page-router-outlet actionBarVisibility="never"></page-router-outlet>
9+
</GridLayout>
710
</GridLayout>

e2e/nested-router-tab-view/app/about/about.component.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { Component, ViewContainerRef } from "@angular/core";
2-
import { ModalDialogService, ModalDialogOptions } from "nativescript-angular/directives/dialogs";
1+
import { Component } from "@angular/core";
32
import { RouterExtensions } from "nativescript-angular/router";
43
import { ActivatedRoute } from "@angular/router";
54

@@ -10,8 +9,6 @@ import { ActivatedRoute } from "@angular/router";
109
})
1110
export class AboutComponent {
1211
constructor(
13-
private modal: ModalDialogService,
14-
private vcRef: ViewContainerRef,
1512
private activeRoute: ActivatedRoute,
1613
private routerExtension: RouterExtensions) { }
1714

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1 @@
1-
<page-router-outlet tag="mainPRO"></page-router-outlet>
2-
3-
<!-- <TabView androidTabsPosition="bottom">
4-
<page-router-outlet
5-
*tabItem="{title: 'Players'}"
6-
name="playerTab">
7-
</page-router-outlet>
8-
9-
<page-router-outlet
10-
*tabItem="{title: 'Teams'}"
11-
name="teamTab">
12-
</page-router-outlet>
13-
</TabView> -->
1+
<page-router-outlet></page-router-outlet>

e2e/nested-router-tab-view/app/app.routing.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { LoginComponent } from "./login/login.component";
1010
import { TabsComponent } from "./tabs/tabs.component";
1111
import { HomeComponent } from "./home/home.component";
1212
import { AboutComponent } from "./about/about.component";
13+
import { AboutNestedComponent } from "./about/about-nested.component";
1314

1415
import { ModalComponent } from "./modal/modal.component";
1516
import { NestedModalComponent } from "./modal-nested/modal-nested.component";
@@ -56,7 +57,11 @@ const routes: Routes = [
5657
{ path: "team/:id", component: TeamDetailComponent, outlet: "teamTab" },
5758
]
5859
},
59-
{ path: "about", component: AboutComponent }
60+
{
61+
path: "about", component: AboutComponent, children: [
62+
{ path: "about-nested", component: AboutNestedComponent },
63+
]
64+
}
6065
];
6166

6267
@NgModule({

e2e/nested-router-tab-view/app/home/home.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
<GridLayout row="1" columns="*,*">
2929
<GridLayout col="0">
3030
<page-router-outlet name="playerTab"></page-router-outlet>
31-
<!-- <page-router-outlet></page-router-outlet> -->
3231
</GridLayout>
3332
<GridLayout col="1">
3433
<page-router-outlet name="teamTab"></page-router-outlet>

e2e/nested-router-tab-view/app/shared.module.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { DataService } from "./data.service";
88

99
import { HomeComponent } from "./home/home.component";
1010
import { AboutComponent } from "./about/about.component";
11+
import { AboutNestedComponent } from "./about/about-nested.component";
1112
import { PlayerComponent } from "./player/players.component";
1213
import { PlayerDetailComponent } from "./player/player-detail.component";
1314
import { TeamsComponent } from "./team/teams.component";
@@ -21,6 +22,7 @@ import { TeamDetailComponent } from "./team/team-detail.component";
2122
declarations: [
2223
HomeComponent,
2324
AboutComponent,
25+
AboutNestedComponent,
2426
PlayerComponent,
2527
PlayerDetailComponent,
2628
TeamsComponent,
@@ -29,6 +31,7 @@ import { TeamDetailComponent } from "./team/team-detail.component";
2931
exports: [
3032
HomeComponent,
3133
AboutComponent,
34+
AboutNestedComponent,
3235
PlayerComponent,
3336
PlayerDetailComponent,
3437
TeamsComponent,

e2e/nested-router-tab-view/app/tabs/tabs.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<StackLayout>
44
<GridLayout rows="auto,*">
55
<WrapLayout row="0">
6-
<Button text="Go To About Page" [nsRouterLink]="['../about']"></Button>
6+
<Button text="Go To About Page" [nsRouterLink]="['../about/about-nested']"></Button>
77
<Button text="Back()" (tap)="back()"></Button>
88
<Button text="CanGoBack(ActivatedRoute)" (tap)="canGoBack()"></Button>
99
<Button text="Back(ActivatedRoute)" (tap)="backActivatedRoute()"></Button>

e2e/nested-router-tab-view/e2e/home-tabs.e2e-spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ describe("home-tabs:", () => {
4848
await screen.loadedPlayersList();
4949
await screen.navigateToAboutPage();
5050
await screen.loadedAbout();
51+
await screen.loadedNestedAbout();
5152
});
5253

5354
it("should go back to Tabs and then back to Home", async () => {

e2e/nested-router-tab-view/e2e/screen.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { assert } from "chai";
33

44
const home = "Home Component";
55
const about = "About Component";
6+
const aboutNested = "Nested About Component";
67
const login = "Login Component";
78
const tabs = "Tabs Component";
89

@@ -70,7 +71,13 @@ export class Screen {
7071
loadedAbout= async () => {
7172
const lblAbout = await this._driver.findElementByAutomationText(about);
7273
assert.isTrue(await lblAbout.isDisplayed());
73-
console.log(home + " loaded!");
74+
console.log(about + " loaded!");
75+
}
76+
77+
loadedNestedAbout= async () => {
78+
const lblAboutNested = await this._driver.findElementByAutomationText(aboutNested);
79+
assert.isTrue(await lblAboutNested.isDisplayed());
80+
console.log(aboutNested + " loaded!");
7481
}
7582

7683
loadedTabs = async () => {

0 commit comments

Comments
 (0)