Skip to content

Commit 9edd4b8

Browse files
author
vakrilov
committed
chore(test): Tests app run for IOS
1 parent 1808866 commit 9edd4b8

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

Diff for: nativescript-angular/element-registry.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { View } from "tns-core-modules/ui/core/view";
22
import { LayoutBase } from "tns-core-modules/ui/layouts/layout-base";
3+
import { Page } from "tns-core-modules/ui/page";
4+
import { Frame } from "tns-core-modules/ui/frame";
35

46
export type NgView = (View & ViewExtensions);
57

@@ -157,6 +159,19 @@ export function getSingleViewRecursive(nodes: Array<any>, nestLevel: number): Vi
157159
return rootLayout;
158160
}
159161

162+
const frameMeta: ViewClassMeta = {
163+
insertChild: (parent: Frame, child: NgView, next: any) => {
164+
// Page cannot be added to Frame with _addChildFromBuilder (trows "use defaultPage" error)
165+
if (isInvisibleNode(child)) {
166+
return;
167+
} else if (child instanceof Page) {
168+
parent.navigate({ create: () => child });
169+
} else {
170+
throw new Error("Only a Page can be a child of Frame");
171+
}
172+
}
173+
}
174+
160175
// Register default NativeScript components
161176
// Note: ActionBar related components are registerd together with action-bar directives.
162177
registerElement("AbsoluteLayout", () => require("tns-core-modules/ui/layouts/absolute-layout").AbsoluteLayout);
@@ -166,7 +181,7 @@ registerElement("Button", () => require("tns-core-modules/ui/button").Button);
166181
registerElement("ContentView", () => require("tns-core-modules/ui/content-view").ContentView);
167182
registerElement("DatePicker", () => require("tns-core-modules/ui/date-picker").DatePicker);
168183
registerElement("DockLayout", () => require("tns-core-modules/ui/layouts/dock-layout").DockLayout);
169-
registerElement("Frame", () => require("tns-core-modules/ui/frame").Frame);
184+
registerElement("Frame", () => require("tns-core-modules/ui/frame").Frame, frameMeta);
170185
registerElement("GridLayout", () => require("tns-core-modules/ui/layouts/grid-layout").GridLayout);
171186
registerElement("HtmlView", () => require("tns-core-modules/ui/html-view").HtmlView);
172187
registerElement("Image", () => require("tns-core-modules/ui/image").Image);

Diff for: tests/app/App_Resources/Android/app.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
android {
99
defaultConfig {
1010
generatedDensities = []
11-
applicationId = "org.nativescript.tests"
11+
applicationId = "org.nativescript.ngtests"
1212

1313
//override supported platforms
1414
// ndk {

Diff for: tests/app/single-page-main.component.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ import {SecondComponent} from "./second.component";
77
@Component({
88
selector: "single-page-main",
99
template: `
10-
<StackLayout>
11-
<Label text="Single-page router"></Label>
12-
<router-outlet></router-outlet>
13-
</StackLayout>
10+
<Frame>
11+
<Page>
12+
<StackLayout>
13+
<Label text="Single-page router"></Label>
14+
<router-outlet></router-outlet>
15+
</StackLayout>
16+
</Page>
17+
</Frame>
1418
`
1519
})
1620
export class SinglePageMain {

0 commit comments

Comments
 (0)