forked from NativeScript/NativeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestRunnerPage.ts
More file actions
47 lines (41 loc) · 1.33 KB
/
testRunnerPage.ts
File metadata and controls
47 lines (41 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import * as tests from "../testRunner";
import * as pages from "tns-core-modules/ui/page";
import * as bm from "tns-core-modules/ui/button";
import * as listViewDef from "tns-core-modules/ui/list-view";
import * as trace from "tns-core-modules/trace";
trace.enable();
trace.addCategories(trace.categories.Test + "," + trace.categories.Error);
export function createPage() {
var data: string[] = [""];
for (var testModule in tests.allTests) {
data.push(testModule);
}
var listView = new listViewDef.ListView();
listView.on(listViewDef.ListView.itemLoadingEvent, (args: listViewDef.ItemEventData) => {
var btn = <bm.Button> args.view;
if (btn) {
btn.off(bm.Button.tapEvent);
}
else {
btn = new bm.Button();
args.view = btn;
}
if (!data[args.index]) {
btn.text = "Run all";
btn.on(bm.Button.tapEvent, function () {
tests.runAll();
});
} else {
var testModule = data[args.index];
btn.text = testModule;
btn.on(bm.Button.tapEvent, function () {
tests.runAll(testModule);
});
}
});
listView.items = data;
var page = new pages.Page();
page.content = listView;
return page;
}
//export var Page = page;