Skip to content

Commit 767b196

Browse files
ADjenkovADjenkov
ADjenkov
authored and
ADjenkov
committed
chore(e2e-tests): enable shared modal tests with tab root
1 parent f8c7468 commit 767b196

9 files changed

+212
-154
lines changed

Diff for: e2e/modal-navigation-ng/app/app.css

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ In many cases you may want to use the NativeScript core theme instead
99
of writing your own CSS rules. For a full list of class names in the theme
1010
refer to http://docs.nativescript.org/ui/theme.
1111
*/
12-
@import '~nativescript-theme-core/css/core.light.css';
1312
Button {
1413
font-size: 10px;
15-
}
14+
}

Diff for: e2e/modal-navigation-ng/app/app.ios.css

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#home-page {
2+
font-size: 10;
3+
margin: 0px;
4+
padding: 0px;
5+
}
6+
#home-page Button {
7+
margin-bottom: 20px;
8+
padding: 20px;
9+
border-color: gray;
10+
border-width: 2px;
11+
border-radius: 8px;
12+
}

Diff for: e2e/modal-navigation-ng/app/app.routing.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ const routesTab: Routes = [
102102
path: "modal-second", component: ModalSecondComponent
103103
}
104104
]
105+
},
106+
{
107+
path: "modal-shared", component: ModalViewContentComponent, outlet: "modalOutlet"
108+
},
109+
{
110+
path: "modal-shared-second-host", component: ModalSharedSecondComponent
105111
}
106112
];
107113

@@ -113,7 +119,6 @@ const routesLayout: Routes = [
113119
{ path: "modal-second", component: ModalSecondComponent }
114120
]
115121

116-
117122
@NgModule({
118123
imports: [NativeScriptRouterModule.forRoot(routes)],
119124
exports: [NativeScriptRouterModule]

Diff for: e2e/modal-navigation-ng/app/home/home.component.html

+21-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1-
<ActionBar class="action-bar">
2-
<Label class="action-bar-title" text="Home Component" automationText="Home Component" ></Label>
1+
<ActionBar >
2+
<Label text="Home Component" automationText="Home Component"></Label>
33
</ActionBar>
44

5-
<WrapLayout>
6-
<Button text="Show Modal Without Frame" (tap)="onModalNoFrame()"></Button>
7-
<Button text="Show Modal Page With Frame" (tap)="onModalFrame()"></Button>
8-
<Button text="Navigate To Second Page" (tap)="onNavigateSecond()"></Button>
9-
<Button text="Reset Named Frame Root View" (tap)="onNamedFrameRootViewReset()"></Button>
10-
<Button text="Reset Frame Root View" (tap)="onFrameRootViewReset()"></Button>
11-
<Button text="Reset Tab Root View" (tap)="onTabRootViewReset()"></Button>
12-
<Button text="Reset Layout Root View" automationText="Reset Layout Root View" (tap)="onLayoutRootViewReset()"></Button>
13-
<Button text="Show Dialog" (tap)="onShowDialog()"></Button>
5+
<GridLayout rows="auto" columns="auto, *" >
6+
<StackLayout id="home-page" row="0" col="0" borderColor="yellowgreen" borderWidth="1" borderRadius="5" padding="2">
7+
<TextView text="Reset root" editable="false" ></TextView>
8+
<Button text="Reset Named Frame Root View" (tap)="onNamedFrameRootViewReset()" textAlignment="left" ></Button>
9+
<Button text="Reset Frame Root View" (tap)="onFrameRootViewReset()" textAlignment="left" ></Button>
10+
<Button text="Reset Tab Root View" (tap)="onTabRootViewReset()" textAlignment="left" ></Button>
11+
<Button text="Reset Layout Root View" automationText="Reset Layout Root View" (tap)="onLayoutRootViewReset()" textAlignment="left"></Button>
12+
</StackLayout>
13+
<StackLayout id="home-page" row="0" col="1" borderColor="blue" borderWidth="1" borderRadius="5" marginLeft="2"
14+
padding="2">
15+
<TextView text="Navigate to example" editable="false"></TextView>
1416

15-
<Button text="show shared modal" (tap)="onRootModalTap()"></Button>
16-
<Button text="go to second (to open shared modal)" [nsRouterLink]="['/modal-shared-second-host']"></Button>
17-
</WrapLayout>
17+
<Button text="Show Modal Without Frame" (tap)="onModalNoFrame()" textAlignment="left"></Button>
18+
<Button text="Show Modal Page With Frame" (tap)="onModalFrame()" textAlignment="left"></Button>
19+
<Button text="Navigate To Second Page" (tap)="onNavigateSecond()" textAlignment="left"></Button>
20+
<Button text="Show Dialog" (tap)="onShowDialog()" textAlignment="left"></Button>
21+
<Button text="show shared modal" (tap)="onRootModalTap()" textAlignment="left"></Button>
22+
<Button text="go to second (to open shared modal)" [nsRouterLink]="['/modal-shared-second-host']" textAlignment="left"></Button>
23+
</StackLayout>
24+
</GridLayout>

Diff for: e2e/modal-navigation-ng/app/layout.component.html

+19-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
1-
<WrapLayout>
2-
<Label text="Home Component" horizontalAlignment="center"></Label>
3-
<Button text="Show Modal Without Frame" (tap)="onModalNoFrame()"></Button>
4-
<Button text="Show Modal Page With Frame" (tap)="onModalFrame()"></Button>
5-
<Button text="Reset Named Frame Root View" (tap)="onNamedFrameRootViewReset()"></Button>
6-
<Button text="Reset Frame Root View" (tap)="onFrameRootViewReset()"></Button>
7-
<Button text="Reset Tab Root View" (tap)="onTabRootViewReset()"></Button>
8-
<Button text="Reset Layout Root View" (tap)="onLayoutRootViewReset()"></Button>
9-
<Button text="Show Dialog" (tap)="onShowDialog()"></Button>
10-
</WrapLayout>
1+
<GridLayout rows="auto,auto" columns="auto, *">
2+
<Label text="Home Component" row="0" col="0" horizontalAlignment="center"></Label>
3+
<StackLayout id="home-page" row="1" col="0" borderColor="yellowgreen" borderWidth="1" borderRadius="5" padding="2">
4+
<TextView text="Reset root" editable="false"></TextView>
5+
<Button text="Reset Named Frame Root View" (tap)="onNamedFrameRootViewReset()" textAlignment="left"></Button>
6+
<Button text="Reset Frame Root View" (tap)="onFrameRootViewReset()" textAlignment="left"></Button>
7+
<Button text="Reset Tab Root View" (tap)="onTabRootViewReset()" textAlignment="left"></Button>
8+
<Button text="Reset Layout Root View" automationText="Reset Layout Root View" (tap)="onLayoutRootViewReset()"
9+
textAlignment="left"></Button>
10+
</StackLayout>
11+
<StackLayout id="home-page" row="1" col="1" borderColor="blue" borderWidth="1" borderRadius="5" marginLeft="2"
12+
padding="2">
13+
<TextView text="Navigate to example" editable="false"></TextView>
14+
15+
<Button text="Show Modal Without Frame" (tap)="onModalNoFrame()" textAlignment="left"></Button>
16+
<Button text="Show Modal Page With Frame" (tap)="onModalFrame()" textAlignment="left"></Button>
17+
<Button text="Show Dialog" (tap)="onShowDialog()" textAlignment="left"></Button>
18+
</StackLayout>
19+
</GridLayout>

Diff for: e2e/modal-navigation-ng/app/layout.component.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ export class LayoutComponent {
2222
private router: Router,
2323
private location: NSLocationStrategy,
2424
private vcRef: ViewContainerRef,
25-
private _viewContainerRefService: ViewContainerRefService) {
25+
private viewContainerRefService: ViewContainerRefService) {
2626
router.events.subscribe(e => {
2727
if (e instanceof NavigationEnd) {
2828
console.log("[ROUTER]: " + e.toString());
2929
console.log(location.toString());
3030
}
3131
});
3232

33-
this._viewContainerRefService.root = this.vcRef;
33+
this.viewContainerRefService.root = this.vcRef;
3434
}
3535

3636
onModalNoFrame() {

Diff for: e2e/modal-navigation-ng/app/tab.component.ts

+18-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
1-
import { Component, OnInit } from "@angular/core";
1+
import { Component, ViewContainerRef } from "@angular/core";
22
import { Router, NavigationEnd } from "@angular/router";
3-
import { RouterExtensions } from "nativescript-angular/router";
3+
import { NSLocationStrategy } from "nativescript-angular/router/ns-location-strategy";
4+
5+
import { ViewContainerRefService } from "./shared/ViewContainerRefService";
46

57
@Component({
68
selector: "ns-tab",
79
templateUrl: "tab.component.html",
810
})
911

1012
export class TabComponent {
11-
constructor(private routerExtension: RouterExtensions) { }
13+
constructor(
14+
router: Router,
15+
location: NSLocationStrategy,
16+
private _vcRef: ViewContainerRef,
17+
private _viewContainerRefService: ViewContainerRefService) {
18+
router.events.subscribe(e => {
19+
if (e instanceof NavigationEnd) {
20+
console.log("[ROUTER]: " + e.toString());
21+
console.log(location.toString());
22+
}
23+
});
24+
25+
this._viewContainerRefService.root = this._vcRef;
26+
}
1227
}

0 commit comments

Comments
 (0)