import * as TKUnit from "../tk-unit"; import { EventData, ItemEventData, ListView, Builder, Button, Switch, SearchBar, TextField, GridLayout, AbsoluteLayout, Observable, TabView, Page, Label, platformNames, Device, GestureTypes, StackLayout, SegmentedBar, View, getAncestor, eachDescendant, PercentLength, Length, Utils, SegmentedBarItem } from "@nativescript/core"; import { TemplateView } from "./template-builder-tests/template-view"; import * as helper from "../ui-helper"; export function test_load_IsDefined() { TKUnit.assertTrue(Utils.isFunction(Builder.load), "Builder should have load method!"); } export function test_parse_IsDefined() { TKUnit.assertTrue(Utils.isFunction(Builder.parse), "Builder should have parse method!"); } export function test_load_ShouldThrowWithInvalidFileName() { TKUnit.assertThrows(() => Builder.load("./xml-declaration/invalid-page.xml"), "Loading component from a missing module SHOULD throw an error."); } export function test_load_ShouldNotCrashWithoutExports() { var v = Builder.load("./xml-declaration/mainPage.xml"); TKUnit.assertTrue(v instanceof 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, "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 =