Skip to content

Commit 90be5ad

Browse files
committed
test(location): add location strategy tests
1 parent fe96c5c commit 90be5ad

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
@@ -3,6 +3,7 @@ import { ActivatedRoute, Router, Route } from "@angular/router";
33

44
import { Page } from "ui/page";
55
import { Observable } from "rxjs/Observable";
6+
import { RouterExtensions } from "nativescript-angular/router";
67

78
@Component({
89
selector: "second",
@@ -17,11 +18,12 @@ import { Observable } from "rxjs/Observable";
1718
1819
<StackLayout>
1920
<Label [text]="'Second Component: ' + (id$ | async)" class="title"></Label>
21+
<Button text="Back" (tap)="back()"></Button>
2022
</StackLayout>`
2123
})
2224
export class SecondComponent implements OnInit, OnDestroy {
2325
public id$: Observable<number>;
24-
constructor(route: ActivatedRoute) {
26+
constructor(route: ActivatedRoute, private routerExtensions: RouterExtensions) {
2527
this.id$ = route.params.map(r => +r["id"]);
2628
}
2729

@@ -32,4 +34,8 @@ export class SecondComponent implements OnInit, OnDestroy {
3234
ngOnDestroy() {
3335
console.log("SecondComponent - ngOnDestroy()");
3436
}
37+
38+
back() {
39+
this.routerExtensions.back();
40+
}
3541
}

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)