-
-
Notifications
You must be signed in to change notification settings - Fork 241
fix(location-strategy): extend support for nested primary outlets #1717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<page-router-outlet></page-router-outlet> | ||
<page-router-outlet tag="rootPRO"></page-router-outlet> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
e2e/nested-router-tab-view/app/custom-tabs/custom-tabs.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<ActionBar title="Custom Tabs Component" class="action-bar"> | ||
<NavigationButton text="Root Back"></NavigationButton> | ||
|
||
<StackLayout orientation="horizontal"> | ||
<Button horizontalAlignment="left" android:visibility="visible" ios:visibility="collapse" text="Root Back" (tap)="onRootBack()"></Button> | ||
<Label horizontalAlignment="center" text="Custom Tabs Component"></Label> | ||
</StackLayout> | ||
</ActionBar> | ||
|
||
<GridLayout rows="50,*, auto"> | ||
<!-- <Button row="0" text="CanGoBack(ParentRoute)" automationText="CanGoBack(ParentRoute)" col="3" (tap)="canGoBackParentRoute()"></Button> --> | ||
<GridLayout row="1"> | ||
<page-router-outlet tag="customTabsPRO"></page-router-outlet> | ||
</GridLayout> | ||
<GridLayout row="2" columns="*, *"> | ||
<Button col="0" text="Players Tab" [nsRouterLink]="['../tabs/players']"></Button> | ||
<Button col="1" text="Teams Tab" [nsRouterLink]="['../tabs/teams']"></Button> | ||
</GridLayout> | ||
</GridLayout> |
44 changes: 44 additions & 0 deletions
44
e2e/nested-router-tab-view/app/custom-tabs/custom-tabs.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Component, OnInit } from '@angular/core'; | ||
import { ModalDialogService, ModalDialogOptions } from "nativescript-angular/directives/dialogs"; | ||
import { RouterExtensions } from "nativescript-angular/router"; | ||
import { ActivatedRoute } from "@angular/router"; | ||
import { confirm } from "tns-core-modules/ui/dialogs"; | ||
import { Page } from 'tns-core-modules/ui/page/page'; | ||
|
||
@Component({ | ||
moduleId: module.id, | ||
selector: 'custom-tabs', | ||
templateUrl: './custom-tabs.component.html' | ||
}) | ||
export class CustomTabsComponent implements OnInit { | ||
|
||
constructor( | ||
private activeRoute: ActivatedRoute, | ||
private routerExtension: RouterExtensions, | ||
private page: Page) { } | ||
|
||
ngOnInit() { | ||
} | ||
|
||
canGoBackParentRoute() { | ||
const canGoBackParentRoute = this.routerExtension.canGoBack({ relativeTo: this.activeRoute }); | ||
const title = "CanGoBack(ParentRoute)"; | ||
this.onShowDialog(title, title + ` ${canGoBackParentRoute}`); | ||
} | ||
|
||
onRootBack() { | ||
this.page.frame.goBack(); | ||
} | ||
|
||
onShowDialog(title: string, result: string) { | ||
let options: any = { | ||
title: title, | ||
message: result, | ||
okButtonText: "Ok" | ||
} | ||
|
||
confirm(options).then((result: boolean) => { | ||
console.log(result); | ||
}) | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
e2e/nested-router-tab-view/app/custom-tabs/custom-tabs.module.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { NgModule, NO_ERRORS_SCHEMA } from '@angular/core'; | ||
import { NativeScriptCommonModule } from 'nativescript-angular/common'; | ||
import { NativeScriptRouterModule } from 'nativescript-angular/router'; | ||
|
||
import { CustomTabsComponent } from './custom-tabs.component'; | ||
import { PlayerComponent } from "../player/players.component"; | ||
import { PlayerDetailComponent } from "../player/player-detail.component"; | ||
import { TeamsComponent } from "../team/teams.component"; | ||
import { TeamDetailComponent } from "../team/team-detail.component"; | ||
import { Route } from "@angular/router"; | ||
import { SharedModule } from "../shared.module"; | ||
|
||
const routes: Route[] = [ | ||
{ | ||
path: 'tabs', | ||
component: CustomTabsComponent, | ||
children: [ | ||
{ path: "players", component: PlayerComponent }, | ||
{ path: "player/:id", component: PlayerDetailComponent }, | ||
|
||
{ path: "teams", component: TeamsComponent }, | ||
{ path: "team/:id", component: TeamDetailComponent }, | ||
] | ||
}, | ||
]; | ||
|
||
@NgModule({ | ||
declarations: [CustomTabsComponent | ||
], | ||
imports: [ | ||
NativeScriptCommonModule, | ||
NativeScriptRouterModule, | ||
NativeScriptRouterModule.forChild(routes), | ||
SharedModule | ||
], | ||
schemas: [NO_ERRORS_SCHEMA] | ||
}) | ||
export class CustomTabsModule { } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
e2e/nested-router-tab-view/app/player/player-detail.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
e2e/nested-router-tab-view/app/player/players.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
<ActionBar title="Player List" class="action-bar"></ActionBar> | ||
<ActionBar title="Player List" class="action-bar"> | ||
<!-- <NavigationButton visibility="hidden"></NavigationButton> --> | ||
</ActionBar> | ||
|
||
<GridLayout> | ||
<!-- <Button text="Open Named Modal" (tap)="onModalFrame()"></Button> --> | ||
<ListView [items]="items" class="list-group"> | ||
<GridLayout rows="auto,*"> | ||
<ListView row="1" [items]="items" class="list-group"> | ||
<ng-template let-item="item"> | ||
<Label [nsRouterLink]="['../player', item.id]" [text]="item.name" | ||
class="list-group-item"></Label> | ||
<Label [nsRouterLink]="['../player', item.id]" [text]="item.name" class="list-group-item"></Label> | ||
</ng-template> | ||
</ListView> | ||
</GridLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
e2e/nested-router-tab-view/app/team/team-detail.component.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { AppiumDriver, createDriver } from "nativescript-dev-appium"; | ||
import { Screen } from "./screen" | ||
import { | ||
testPlayerNavigated, | ||
testTeamNavigated, | ||
testPlayerNextNavigated, | ||
testTeamNextNavigated, | ||
} from "./shared.e2e-spec" | ||
|
||
describe("custom-tabs:", () => { | ||
let driver: AppiumDriver; | ||
let screen: Screen; | ||
|
||
before(async () => { | ||
driver = await createDriver(); | ||
screen = new Screen(driver); | ||
}); | ||
|
||
after(async () => { | ||
await driver.quit(); | ||
console.log("Quit driver!"); | ||
}); | ||
|
||
afterEach(async function () { | ||
if (this.currentTest.state === "failed") { | ||
await driver.logTestArtifacts(this.currentTest.title); | ||
} | ||
}); | ||
|
||
it("loaded custom tab component and tabs", async () => { | ||
await screen.navigateCustomTabsPage(); | ||
await screen.loadedCustomTabsPage(); | ||
await screen.loadedPlayersList(); | ||
await gotoTeamsTab(driver); | ||
await screen.loadedTeamList(); | ||
}); | ||
|
||
it("navigate back to login and again to custom tabs", async () => { | ||
await backRoot(driver); | ||
await screen.loadedLogin(); | ||
await screen.navigateCustomTabsPage(); | ||
await screen.loadedCustomTabsPage(); | ||
await screen.loadedPlayersList(); | ||
await gotoTeamsTab(driver); | ||
await screen.loadedTeamList(); | ||
}); | ||
|
||
it("navigate back to login and again to custom tabs", async () => { | ||
await gotoPlayersTab(driver); | ||
await testPlayerNavigated(screen, screen.playerOne); | ||
await gotoTeamsTab(driver); | ||
await screen.loadedTeamList(); | ||
await testTeamNavigated(screen, screen.teamOne); | ||
await backRoot(driver); | ||
await screen.loadedLogin(); | ||
}); | ||
}); | ||
|
||
async function backRoot(driver: AppiumDriver) { | ||
const btnBackRoot = await driver.findElementByAutomationText("Root Back"); | ||
await btnBackRoot.tap(); | ||
} | ||
|
||
async function gotoPlayersTab(driver: AppiumDriver) { | ||
const btnTabTeams = await driver.findElementByAutomationText("Players Tab"); | ||
await btnTabTeams.tap(); | ||
} | ||
|
||
async function gotoTeamsTab(driver: AppiumDriver) { | ||
const btnTabTeams = await driver.findElementByAutomationText("Teams Tab"); | ||
await btnTabTeams.tap(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the
tag="rootPRO"
used somewhere or just for debugging?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is just for debugging, since it is very easy to distinguish which p-r-o is activated, states and so on..it's also in the test app only