import * as TKUnit from "../TKUnit"; import * as view from "ui/core/view"; import * as builder from "ui/builder"; import * as buttonModule from "ui/button"; import * as switchModule from "ui/switch"; import * as searchBarModule from "ui/search-bar"; import * as textFieldModule from "ui/text-field"; import * as gridLayoutModule from "ui/layouts/grid-layout"; import * as absoluteLayoutModule from "ui/layouts/absolute-layout"; import * as types from "utils/types"; import * as fs from "file-system"; import * as observable from "data/observable"; import * as stackLayoutModule from "ui/layouts/stack-layout"; import { Label } from "ui/label"; import { Page } from "ui/page"; import { Button } from "ui/button"; import { TabView } from "ui/tab-view"; import { Observable } from "data/observable"; import { TemplateView } from "./template-builder-tests/template-view"; import * as myCustomControlWithoutXml from "./mymodule/MyControl"; import * as listViewModule from "ui/list-view"; import * as helper from "../ui/helper"; import * as viewModule from "ui/core/view"; import * as platform from "platform"; import * as gesturesModule from "ui/gestures"; import * as segmentedBar from "ui/segmented-bar"; import { Source } from "utils/debug"; import { PercentLength } from "ui/core/view"; export function test_load_IsDefined() { TKUnit.assertTrue(types.isFunction(builder.load), "ui/builder should have load method!"); }; export function test_parse_IsDefined() { TKUnit.assertTrue(types.isFunction(builder.parse), "ui/builder should have parse method!"); }; export function test_load_ShouldNotCrashWithInvalidFileName() { var v = builder.load(fs.path.join(__dirname, "mainPage1.xml")); TKUnit.assertTrue(types.isUndefined(v), "Expected result: undefined; Actual result: " + v + ";"); }; export function test_load_ShouldNotCrashWithoutExports() { var v = builder.load(fs.path.join(__dirname, "mainPage.xml")); TKUnit.assertTrue(v instanceof view.View, "Expected result: View; Actual result: " + v + ";"); }; export function test_loadWithOptionsNoXML() { var v = builder.load({ path: "~/xml-declaration/mymodule", name: "MyControl", exports: exports, page: new Page() }); TKUnit.assertTrue(v instanceof view.View, "Expected result: View; Actual result: " + v + ";"); }; export function test_loadWithOptionsNoXML_CSSIsApplied() { let newPage = helper.getCurrentPage(); newPage.content = builder.load({ path: "~/xml-declaration/mymodule", name: "MyControl", exports: exports, page: newPage }); TKUnit.assert(newPage.isLoaded, "The page should be loaded here."); helper.assertViewBackgroundColor(newPage.content, "#FF0000"); }; export function test_loadInheritedPageAndResolveFromChild() { var basePath = "xml-declaration/"; helper.navigateToModuleAndRunTest(basePath + "inherited-page", null, (page) => { let contentLabel =