FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

add test for page overlay controls · NativeScript/NativeScript@226ab3c · GitHub

Commit 226ab3c

Browse files
committed
add test for page overlay controls
1 parent 8a7d672 commit 226ab3c

3 files changed

Lines changed: 476 additions & 256 deletions

File tree

‎tests/app/testRunner.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import * as platform from "tns-core-modules/platform";
1111
import "./ui-test";
1212
import * as fs from "tns-core-modules/file-system";
1313
import { unsetValue } from "tns-core-modules/ui/core/properties";
14-
import { ad } from "tns-core-modules/utils/utils";
14+
import { ad, ios } from "tns-core-modules/utils/utils";
1515

1616
Frame.defaultAnimatedNavigation = false;
1717

@@ -136,7 +136,7 @@ import * as flexBoxLayoutTests from "./ui/layouts/flexbox-layout-tests";
136136
allTests["FLEXBOXLAYOUT"] = flexBoxLayoutTests;
137137

138138
import * as safeAreaLayoutTests from "./ui/layouts/safe-area-tests";
139-
if (platform.device.os === platform.platformNames.ios) {
139+
if (platform.isIOS && ios.MajorVersion > 10) {
140140
allTests["SAFEAREALAYOUT"] = safeAreaLayoutTests;
141141
}
142142

‎tests/app/ui/helper.ts‎

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,50 @@ export function do_PageTest_WithStackLayout_AndButton(test: (views: [Page, Stack
7979
newPage.content = null;
8080
}
8181

82+
export interface PageOptions {
83+
pageCss?: any,
84+
actionBar?: boolean,
85+
actionBarFlat?: boolean,
86+
actionBarHidden?: boolean,
87+
tabBar?: boolean
88+
}
89+
8290
//export function buildUIAndRunTest(controlToTest, testFunction, options) {
83-
export function buildUIAndRunTest<T extends View>(controlToTest: T, testFunction: (views: [T, Page]) => void, options?: {pageCss}) {
91+
export function buildUIAndRunTest<T extends View>(controlToTest: T, testFunction: (views: [T, Page]) => void, options?: PageOptions) {
8492
clearPage();
8593
let newPage = getCurrentPage();
8694

95+
let testSubject = controlToTest as View;
96+
8797
if (options) {
88-
newPage.css = options.pageCss;
98+
if (options.pageCss) {
99+
newPage.css = options.pageCss;
100+
}
101+
102+
if (options.actionBar) {
103+
newPage.actionBar.title = "Test";
104+
}
105+
106+
if (options.actionBarFlat) {
107+
newPage.actionBar.title = "Test";
108+
newPage.actionBar.flat = true;
109+
}
110+
111+
if (options.actionBarHidden) {
112+
newPage.actionBarHidden = true;
113+
}
114+
115+
if (options.tabBar) {
116+
const tabView = new TabView();
117+
const tabEntry = new TabViewItem();
118+
tabEntry.title = "Test";
119+
tabEntry.view = controlToTest;
120+
tabView.items = [tabEntry];
121+
testSubject = tabView;
122+
}
89123
}
90124

91-
newPage.content = controlToTest;
125+
newPage.content = testSubject;
92126

93127
testFunction([controlToTest, newPage]);
94128
newPage.content = null;

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL