Skip to content

Commit 81f431b

Browse files
committed
test(location): add location strategy tests
1 parent c83559c commit 81f431b

16 files changed

+334
-328
lines changed

Diff for: e2e/modal-navigation-ng/e2e/config/appium.capabilities.json

-98
This file was deleted.

Diff for: e2e/modal-navigation-ng/e2e/config/mocha.opts

-4
This file was deleted.

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

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
<TabView androidTabsPosition="bottom">
22
<page-router-outlet
33
*tabItem="{title: 'Players'}"
4-
name="playerTab"
5-
(activate)='onActivate(0)'>
4+
name="playerTab">
65
</page-router-outlet>
76

87
<page-router-outlet
98
*tabItem="{title: 'Teams'}"
10-
name="teamTab"
11-
(activate)='onActivate(1)'>
9+
name="teamTab">
1210
</page-router-outlet>
1311
</TabView>

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

+1-13
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,11 @@ export class AppComponent {
1616

1717
constructor(router: Router, location: NSLocationStrategy) {
1818
router.events.subscribe(e => {
19-
// console.log("[ROUTER]: " + e.toString());
20-
2119
if (e instanceof NavigationEnd) {
2220
this.isInitialNavigation = false;
2321
console.log("[ROUTER]: " + e.toString());
24-
// console.log("[ROUTER] NAVIGATION END. Location history:");
25-
location._getStates().forEach(state => {
26-
console.log(`[page: ${state.isPageNavigation}] ${state.url}`);
27-
});
22+
console.log(location.toString());
2823
}
2924
})
3025
}
31-
32-
onActivate(tabIndex: number) {
33-
// if (!this.isInitialNavigation && this.tabView.selectedIndex !== tabIndex) {
34-
// console.log(`---> onActivate changing tabIndex from: ${this.tabView.selectedIndex} to: ${tabIndex}`);
35-
// this.tabView.selectedIndex = tabIndex;
36-
// }
37-
}
3826
}

Diff for: e2e/router-tab-view/e2e/config/appium.capabilities.json

-106
This file was deleted.

Diff for: e2e/router-tab-view/e2e/config/mocha.opts

-4
This file was deleted.

Diff for: e2e/router-tab-view/e2e/tab-view-navigation.e2e-spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe("TabView with page-router-outlet in each tab", () => {
1919
}
2020
});
2121

22-
it("should find an tabs by text", async () => {
22+
it("should find any tabs by text", async () => {
2323
await driver.findElementByText("Players", SearchOptions.exact);
2424
await driver.findElementByText("Teams", SearchOptions.exact);
2525
await driver.findElementByText("Player List", SearchOptions.exact);

Diff for: e2e/single-page/app/second/second.component.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ActivatedRoute, Router, Route } from "@angular/router";
44
import { Page } from "ui/page";
55
import { Observable } from "rxjs";
66
import { map } from "rxjs/operators";
7+
import { RouterExtensions } from "nativescript-angular/router";
78

89
@Component({
910
selector: "second",
@@ -18,11 +19,12 @@ import { map } from "rxjs/operators";
1819
1920
<StackLayout>
2021
<Label [text]="'Second Component: ' + (id$ | async)" class="title"></Label>
22+
<Button text="Back" (tap)="back()"></Button>
2123
</StackLayout>`
2224
})
2325
export class SecondComponent implements OnInit, OnDestroy {
2426
public id$: Observable<number>;
25-
constructor(route: ActivatedRoute) {
27+
constructor(route: ActivatedRoute, private routerExtensions: RouterExtensions) {
2628
this.id$ = route.params.pipe(map(r => +r["id"]));
2729
}
2830

@@ -33,4 +35,8 @@ export class SecondComponent implements OnInit, OnDestroy {
3335
ngOnDestroy() {
3436
console.log("SecondComponent - ngOnDestroy()");
3537
}
38+
39+
back() {
40+
this.routerExtensions.back();
41+
}
3642
}

Diff for: nativescript-angular/directives/dialogs.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export class ModalDialogService {
124124
const detachedProxy = <ProxyViewContainer>compRef.location.nativeElement;
125125

126126
if (detachedProxy.getChildrenCount() > 1) {
127-
throw new Error("Modal contet has more than one root view.");
127+
throw new Error("Modal content has more than one root view.");
128128
}
129129
componentView = detachedProxy.getChildAt(0);
130130

0 commit comments

Comments
 (0)