Skip to content

Commit 207da55

Browse files
Merge branch 'master' into android-runtime-test
2 parents 74bb2ff + c06d5ba commit 207da55

23 files changed

Lines changed: 373 additions & 158 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { EventData } from 'tns-core-modules/data/observable';
2+
import { Page } from 'tns-core-modules/ui/page';
3+
import { Button } from "tns-core-modules/ui/button";
4+
import { Label } from "tns-core-modules/ui/label";
5+
import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
6+
import { GridLayout } from "tns-core-modules/ui/layouts/grid-layout";
7+
8+
export function toggle(args: EventData) {
9+
const page = <Page>((<any>args.object).page);
10+
11+
const getElementById = id => { return page.getViewById(id); }
12+
13+
const toggleBtn = <Button>getElementById("toggleUserInteraction");
14+
const isEnabled = toggleBtn.text === "disable" ? true : false;
15+
toggleBtn.text = !isEnabled ? "disable" : "enable";
16+
17+
(<Button>getElementById("testBtn")).isUserInteractionEnabled = !isEnabled;
18+
(<Button>getElementById("testLabel")).isUserInteractionEnabled = !isEnabled;
19+
(<StackLayout>getElementById("testStackLayout")).isUserInteractionEnabled = !isEnabled;
20+
}
21+
22+
export function test() {
23+
console.log("onTap");
24+
alert("onTap");
25+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<Page
2+
xmlns="http://schemas.nativescript.org/tns.xsd" class="page">
3+
<StackLayout class="p-20">
4+
<Button text="disable" tap="toggle" id="toggleUserInteraction" automationText="toggleUserInteraction"/>
5+
<GridLayout rows="100 50 100" id="layoutid">
6+
<Button id="testBtn" automationText="testBtn" row="0" isUserInteractionEnabled="{{userinteraction}}" text="test" tap="test" />
7+
<Label id="testLabel" automationText="testLabel" row="1" text="test" isUserInteractionEnabled="{{userinteraction}}" tap="test"/>
8+
<StackLayout id="testStackLayout" automationText="testStackLayout" row="2" isUserInteractionEnabled="{{userinteraction}}" backgroundColor="red" tap="test"></StackLayout>
9+
</GridLayout>
10+
</StackLayout>
11+
</Page>

apps/app/ui-tests-app/issues/main-page.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export function loadExamples() {
2121
examples.set("3175", "issues/issue-3175");
2222
examples.set("3211", "issues/issue-3211");
2323
examples.set("1639", "issues/issue-1639");
24+
examples.set("3714", "issues/issue-3714");
2425
examples.set("1657-ios", "issues/issue-1657-ios");
2526
examples.set("tabview-with-scrollview_4022","issues/tabview-with-scrollview_4022");
2627
examples.set("3354-ios", "issues/issue-3354");

e2e/modal-navigation/app/app.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ import * as application from "tns-core-modules/application";
33

44
application.run({ moduleName: "app-root" });
55
// application.run({ moduleName: "tab-root" });
6+
// application.run({ moduleName: "layout-root" });

e2e/modal-navigation/app/home/home-page.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ export function onModalPage(args: EventData) {
4141
false);
4242
}
4343

44+
export function onModalLayout(args: EventData) {
45+
const view = args.object as View;
46+
view.showModal("modal-layout/modal-layout",
47+
"context",
48+
() => console.log("home-page modal layout closed"),
49+
false);
50+
}
51+
4452
export function onModalTabView(args: EventData) {
4553
const fullscreen = false;
4654
const animated = false;
@@ -61,7 +69,14 @@ export function onNavigate(args: EventData) {
6169
page.frame.navigate("second/second-page");
6270
}
6371

64-
export function onRootViewChange() {
65-
let rootView = application.getRootView();
66-
rootView instanceof Frame ? application._resetRootView({ moduleName: "tab-root" }) : application._resetRootView({ moduleName: "app-root" });
72+
export function onFrameRootViewReset() {
73+
application._resetRootView({ moduleName: "app-root" });
74+
}
75+
76+
export function onTabRootViewReset() {
77+
application._resetRootView({ moduleName: "tab-root" });
6778
}
79+
80+
export function onLayoutRootViewReset() {
81+
application._resetRootView({ moduleName: "layout-root" });
82+
}

e2e/modal-navigation/app/home/home-page.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
<StackLayout>
1313
<Button text="Show Modal Page With Frame" tap="onModalFrame" />
1414
<Button text="Show Modal Page" tap="onModalPage" />
15+
<Button text="Show Modal Layout" tap="onModalLayout" />
1516
<Button text="Show Modal TabView" tap="onModalTabView" />
1617
<Button text="Navigate To Second Page" tap="onNavigate" />
17-
<Button text="Change Root View" tap="onRootViewChange" />
18+
<Button text="Reset Frame Root View" tap="onFrameRootViewReset" />
19+
<Button text="Reset Tab Root View" tap="onTabRootViewReset" />
20+
<Button text="Reset Layout Root View" tap="onLayoutRootViewReset" />
1821
</StackLayout>
1922
</Page>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<GridLayout>
2+
<Frame defaultPage="home/home-page" />
3+
</GridLayout>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export function onShowingModally() {
2+
console.log("modal-layout showingModally");
3+
}
4+
5+
export function onLoaded() {
6+
console.log("modal-layout loaded");
7+
}
8+
9+
export function onNavigatingTo() {
10+
console.log("modal-layout onNavigatingTo");
11+
}
12+
13+
export function onNavigatingFrom() {
14+
console.log("modal-layout onNavigatingFrom");
15+
}
16+
17+
export function onNavigatedTo() {
18+
console.log("modal-layout onNavigatedTo");
19+
}
20+
21+
export function onNavigatedFrom() {
22+
console.log("modal-layout onNavigatedFrom");
23+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<GridLayout backgroundColor="green" showingModally="onShowingModally" loaded="onLoaded"
2+
navigatingTo="onNavigatingTo"
3+
navigatingFrom="onNavigatingFrom"
4+
navigatedTo="onNavigatedTo"
5+
navigatedFrom="onNavigatedFrom">
6+
<Frame defaultPage="modal/modal-page"></Frame>
7+
</GridLayout>

e2e/modal-navigation/e2e/screen.ts

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ const modalFrame = "Show Modal Page With Frame";
1212
const modalPage = "Show Modal Page";
1313
const modalTabView = "Show Modal TabView";
1414
const navToSecondPage = "Navigate To Second Page";
15-
const rootView = "Change Root View";
15+
const resetFrameRootView = "Reset Frame Root View";
16+
const resetTabRootView = "Reset Tab Root View";
17+
const resetLayoutRootView = "Reset Layout Root View";
1618

1719
const showNestedModalFrame = "Show Nested Modal Page With Frame";
1820
const showNestedModalPage = "Show Nested Modal Page";
@@ -35,9 +37,19 @@ export class Screen {
3537
console.log(home + " loaded!");
3638
}
3739

38-
changeRootView = async () => {
39-
const btnChangeRootView = await this._driver.findElementByText(rootView);
40-
await btnChangeRootView.tap();
40+
resetFrameRootView = async () => {
41+
const btnResetFrameRootView = await this._driver.findElementByText(resetFrameRootView);
42+
await btnResetFrameRootView.tap();
43+
}
44+
45+
resetTabRootView = async () => {
46+
const btnResetTabRootView = await this._driver.findElementByText(resetTabRootView);
47+
await btnResetTabRootView.tap();
48+
}
49+
50+
resetLayoutRootView = async () => {
51+
const btnResetLayoutRootView = await this._driver.findElementByText(resetLayoutRootView);
52+
await btnResetLayoutRootView.tap();
4153
}
4254

4355
loadedTabRootView = async () => {
@@ -52,7 +64,7 @@ export class Screen {
5264
try {
5365
await this.loadedTabRootView();
5466
} catch (err) {
55-
await this.changeRootView();
67+
await this.resetTabRootView();
5668
await this.loadedTabRootView();
5769
}
5870
}

0 commit comments

Comments
 (0)