Skip to content

Commit 1da4cfb

Browse files
Merge pull request NativeScript#1725 from NativeScript/merge-release-in-master
Merge release in master
2 parents 3c7ad92 + c49e65f commit 1da4cfb

22 files changed

+298
-87
lines changed

Diff for: CHANGELOG.md

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
<a name="7.2.1"></a>
2+
## [7.2.1](https://github.com/NativeScript/nativescript-angular/compare/7.2.0...7.2.1) (2019-02-10)
3+
4+
5+
### Bug Fixes
6+
7+
* **location-strategy:** extend support for nested primary outlets ([566896d](https://github.com/NativeScript/nativescript-angular/commit/566896d))
8+
* Router tracing does not work with webpack ([e87ef68](https://github.com/NativeScript/nativescript-angular/commit/e87ef68))
9+
10+
11+
112
<a name="7.2.0"></a>
213
# [7.2.0](https://github.com/NativeScript/nativescript-angular/compare/7.1.2...7.2.0) (2019-01-31)
314

Diff for: e2e/nested-router-tab-view/app/app.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<page-router-outlet></page-router-outlet>
1+
<page-router-outlet tag="rootPRO"></page-router-outlet>

Diff for: e2e/nested-router-tab-view/app/app.routing.ts

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ const routes: Routes = [
4848
path: "home-lazy",
4949
loadChildren: "./home-lazy/home-lazy.module#HomeLazyModule",
5050
},
51+
{
52+
path: "custom-tabs",
53+
loadChildren: "./custom-tabs/custom-tabs.module#CustomTabsModule",
54+
},
5155
{
5256
path: "tabs", component: TabsComponent, children: [
5357
{ path: "players", component: PlayerComponent, outlet: "playerTab" },
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<ActionBar title="Custom Tabs Component" class="action-bar">
2+
<NavigationButton text="Root Back"></NavigationButton>
3+
4+
<StackLayout orientation="horizontal">
5+
<Button horizontalAlignment="left" android:visibility="visible" ios:visibility="collapse" text="Root Back" (tap)="onRootBack()"></Button>
6+
<Label horizontalAlignment="center" text="Custom Tabs Component"></Label>
7+
</StackLayout>
8+
</ActionBar>
9+
10+
<GridLayout rows="50,*, auto">
11+
<!-- <Button row="0" text="CanGoBack(ParentRoute)" automationText="CanGoBack(ParentRoute)" col="3" (tap)="canGoBackParentRoute()"></Button> -->
12+
<GridLayout row="1">
13+
<page-router-outlet tag="customTabsPRO"></page-router-outlet>
14+
</GridLayout>
15+
<GridLayout row="2" columns="*, *">
16+
<Button col="0" text="Players Tab" [nsRouterLink]="['../tabs/players']"></Button>
17+
<Button col="1" text="Teams Tab" [nsRouterLink]="['../tabs/teams']"></Button>
18+
</GridLayout>
19+
</GridLayout>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import { Component, OnInit } from '@angular/core';
2+
import { ModalDialogService, ModalDialogOptions } from "nativescript-angular/directives/dialogs";
3+
import { RouterExtensions } from "nativescript-angular/router";
4+
import { ActivatedRoute } from "@angular/router";
5+
import { confirm } from "tns-core-modules/ui/dialogs";
6+
import { Page } from 'tns-core-modules/ui/page/page';
7+
8+
@Component({
9+
moduleId: module.id,
10+
selector: 'custom-tabs',
11+
templateUrl: './custom-tabs.component.html'
12+
})
13+
export class CustomTabsComponent implements OnInit {
14+
15+
constructor(
16+
private activeRoute: ActivatedRoute,
17+
private routerExtension: RouterExtensions,
18+
private page: Page) { }
19+
20+
ngOnInit() {
21+
}
22+
23+
canGoBackParentRoute() {
24+
const canGoBackParentRoute = this.routerExtension.canGoBack({ relativeTo: this.activeRoute });
25+
const title = "CanGoBack(ParentRoute)";
26+
this.onShowDialog(title, title + ` ${canGoBackParentRoute}`);
27+
}
28+
29+
onRootBack() {
30+
this.page.frame.goBack();
31+
}
32+
33+
onShowDialog(title: string, result: string) {
34+
let options: any = {
35+
title: title,
36+
message: result,
37+
okButtonText: "Ok"
38+
}
39+
40+
confirm(options).then((result: boolean) => {
41+
console.log(result);
42+
})
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core';
2+
import { NativeScriptCommonModule } from 'nativescript-angular/common';
3+
import { NativeScriptRouterModule } from 'nativescript-angular/router';
4+
5+
import { CustomTabsComponent } from './custom-tabs.component';
6+
import { PlayerComponent } from "../player/players.component";
7+
import { PlayerDetailComponent } from "../player/player-detail.component";
8+
import { TeamsComponent } from "../team/teams.component";
9+
import { TeamDetailComponent } from "../team/team-detail.component";
10+
import { Route } from "@angular/router";
11+
import { SharedModule } from "../shared.module";
12+
13+
const routes: Route[] = [
14+
{
15+
path: 'tabs',
16+
component: CustomTabsComponent,
17+
children: [
18+
{ path: "players", component: PlayerComponent },
19+
{ path: "player/:id", component: PlayerDetailComponent },
20+
21+
{ path: "teams", component: TeamsComponent },
22+
{ path: "team/:id", component: TeamDetailComponent },
23+
]
24+
},
25+
];
26+
27+
@NgModule({
28+
declarations: [CustomTabsComponent
29+
],
30+
imports: [
31+
NativeScriptCommonModule,
32+
NativeScriptRouterModule,
33+
NativeScriptRouterModule.forChild(routes),
34+
SharedModule
35+
],
36+
schemas: [NO_ERRORS_SCHEMA]
37+
})
38+
export class CustomTabsModule { }

Diff for: e2e/nested-router-tab-view/app/login/login.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
</ActionBar>
44

55
<StackLayout>
6-
<!-- <Button text="Go To Home Page" [nsRouterLink]="['/home', { outlets: { playerTab: ['players'], teamTab: ['teams'] } }]"></Button> -->
76
<Button text="Go To Home Page" [nsRouterLink]="['../home', { outlets: { playerTab: ['players'], teamTab: ['teams'] } }]"></Button>
87
<Button text="Go To Lazy Home Page" [nsRouterLink]="['../home-lazy/home', { outlets: { playerTab: ['players'], teamTab: ['teams'] } }]"></Button>
8+
<Button text="Go To Lazy Custom Tabs" [nsRouterLink]="['../custom-tabs/tabs/players']"></Button>
99
</StackLayout>

Diff for: e2e/nested-router-tab-view/app/player/player-detail.component.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<ActionBar title="Player Details" class="action-bar"></ActionBar>
1+
<ActionBar title="Player Details" class="action-bar">
2+
<!-- <NavigationButton visibility="hidden"></NavigationButton> -->
3+
</ActionBar>
24
<StackLayout flexDirection="column" class="page" class="m-15">
35
<Label [text]="item.id"></Label>
46
<Label [text]="item.name + ' Details'"></Label>
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<ActionBar title="Player List" class="action-bar"></ActionBar>
1+
<ActionBar title="Player List" class="action-bar">
2+
<!-- <NavigationButton visibility="hidden"></NavigationButton> -->
3+
</ActionBar>
24

3-
<GridLayout>
4-
<!-- <Button text="Open Named Modal" (tap)="onModalFrame()"></Button> -->
5-
<ListView [items]="items" class="list-group">
5+
<GridLayout rows="auto,*">
6+
<ListView row="1" [items]="items" class="list-group">
67
<ng-template let-item="item">
7-
<Label [nsRouterLink]="['../player', item.id]" [text]="item.name"
8-
class="list-group-item"></Label>
8+
<Label [nsRouterLink]="['../player', item.id]" [text]="item.name" class="list-group-item"></Label>
99
</ng-template>
1010
</ListView>
1111
</GridLayout>

Diff for: e2e/nested-router-tab-view/app/player/players.component.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Component, OnInit, ViewContainerRef } from "@angular/core";
22
import { DataService, DataItem } from "../data.service";
3-
import { RouterExtensions } from "nativescript-angular/router";
43

54
import { ModalDialogService, ModalDialogOptions } from "nativescript-angular/directives/dialogs";
65
import { ModalRouterComponent } from "../modal/modal-router/modal-router.component";
@@ -12,7 +11,10 @@ import { ModalRouterComponent } from "../modal/modal-router/modal-router.compone
1211
export class PlayerComponent implements OnInit {
1312
items: DataItem[];
1413

15-
constructor(private modal: ModalDialogService, private itemService: DataService, private router: RouterExtensions, private vcRef: ViewContainerRef, ) { }
14+
constructor(
15+
private modal: ModalDialogService,
16+
private itemService: DataService,
17+
private vcRef: ViewContainerRef, ) { }
1618

1719
ngOnInit(): void {
1820
this.items = this.itemService.getPlayers();

Diff for: e2e/nested-router-tab-view/app/team/team-detail.component.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<ActionBar title="Team Details" class="action-bar"></ActionBar>
1+
<ActionBar title="Team Details" class="action-bar">
2+
<!-- <NavigationButton visibility="hidden"></NavigationButton> -->
3+
</ActionBar>
24
<StackLayout flexDirection="column" class="page" class="m-15">
35
<Label [text]="item.id"></Label>
46
<Label [text]="item.name + ' Details'"></Label>

Diff for: e2e/nested-router-tab-view/app/team/teams.component.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<ActionBar title="Team List" class="action-bar"></ActionBar>
1+
<ActionBar title="Team List" class="action-bar">
2+
<!-- <NavigationButton visibility="hidden"></NavigationButton> -->
3+
</ActionBar>
24

35
<GridLayout>
46
<ListView [items]="items" class="list-group">
+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { AppiumDriver, createDriver } from "nativescript-dev-appium";
2+
import { Screen } from "./screen"
3+
import {
4+
testPlayerNavigated,
5+
testTeamNavigated,
6+
testPlayerNextNavigated,
7+
testTeamNextNavigated,
8+
} from "./shared.e2e-spec"
9+
10+
describe("custom-tabs:", () => {
11+
let driver: AppiumDriver;
12+
let screen: Screen;
13+
14+
before(async () => {
15+
driver = await createDriver();
16+
screen = new Screen(driver);
17+
});
18+
19+
after(async () => {
20+
await driver.quit();
21+
console.log("Quit driver!");
22+
});
23+
24+
afterEach(async function () {
25+
if (this.currentTest.state === "failed") {
26+
await driver.logTestArtifacts(this.currentTest.title);
27+
}
28+
});
29+
30+
it("loaded custom tab component and tabs", async () => {
31+
await screen.navigateCustomTabsPage();
32+
await screen.loadedCustomTabsPage();
33+
await screen.loadedPlayersList();
34+
await gotoTeamsTab(driver);
35+
await screen.loadedTeamList();
36+
});
37+
38+
it("navigate back to login and again to custom tabs", async () => {
39+
await backRoot(driver);
40+
await screen.loadedLogin();
41+
await screen.navigateCustomTabsPage();
42+
await screen.loadedCustomTabsPage();
43+
await screen.loadedPlayersList();
44+
await gotoTeamsTab(driver);
45+
await screen.loadedTeamList();
46+
});
47+
48+
it("navigate back to login and again to custom tabs", async () => {
49+
await gotoPlayersTab(driver);
50+
await testPlayerNavigated(screen, screen.playerOne);
51+
await gotoTeamsTab(driver);
52+
await screen.loadedTeamList();
53+
await testTeamNavigated(screen, screen.teamOne);
54+
await backRoot(driver);
55+
await screen.loadedLogin();
56+
});
57+
});
58+
59+
async function backRoot(driver: AppiumDriver) {
60+
const btnBackRoot = await driver.findElementByAutomationText("Root Back");
61+
await btnBackRoot.tap();
62+
}
63+
64+
async function gotoPlayersTab(driver: AppiumDriver) {
65+
const btnTabTeams = await driver.findElementByAutomationText("Players Tab");
66+
await btnTabTeams.tap();
67+
}
68+
69+
async function gotoTeamsTab(driver: AppiumDriver) {
70+
const btnTabTeams = await driver.findElementByAutomationText("Teams Tab");
71+
await btnTabTeams.tap();
72+
}

Diff for: e2e/nested-router-tab-view/e2e/screen.ts

+13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { AppiumDriver, SearchOptions } from "nativescript-dev-appium";
22
import { assert } from "chai";
33

4+
const customTabs = "Custom Tabs Component";
45
const home = "Home Component";
56
const about = "About Component";
67
const aboutNested = "Nested About Component";
@@ -18,6 +19,7 @@ const gotoNextTeam = "next team";
1819
const gotoTeams = "teams";
1920

2021
const gotoHomePage = "Go To Home Page";
22+
const gotoCustomTabPage = "Go To Lazy Custom Tabs";
2123
const gotoAboutPage = "Go To About Page";
2224
const gotoTabsPage = "Go To Tabs Page";
2325
const confirmDialog = "Ok";
@@ -68,6 +70,12 @@ export class Screen {
6870
console.log(home + " loaded!");
6971
}
7072

73+
loadedCustomTabsPage= async () => {
74+
const lblCustomTabs = await this._driver.findElementByAutomationText(customTabs);
75+
assert.isTrue(await lblCustomTabs.isDisplayed());
76+
console.log(home + " loaded!");
77+
}
78+
7179
loadedAbout= async () => {
7280
const lblAbout = await this._driver.findElementByAutomationText(about);
7381
assert.isTrue(await lblAbout.isDisplayed());
@@ -128,6 +136,11 @@ export class Screen {
128136
await btnNavToHomePage.tap();
129137
}
130138

139+
navigateCustomTabsPage = async () => {
140+
const btnNavToHomePage = await this._driver.findElementByAutomationText(gotoCustomTabPage);
141+
await btnNavToHomePage.tap();
142+
}
143+
131144
navigateToAboutPage = async () => {
132145
const btnNavToAboutPage = await this._driver.findElementByAutomationText(gotoAboutPage);
133146
await btnNavToAboutPage.tap();

0 commit comments

Comments
 (0)