mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Tests moved into separate folders (#3794)
Fix android crash on application exit
This commit is contained in:
BIN
tests/app/App_Resources/Android/drawable-nodpi/icon.png
Executable file
BIN
tests/app/App_Resources/Android/drawable-nodpi/icon.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
@ -2,7 +2,7 @@
|
||||
var appSettings = require("application-settings");
|
||||
// << application-settings-require
|
||||
|
||||
import * as TKUnit from "./TKUnit";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
|
||||
var stringKey:string = "stringKey";
|
||||
var boolKey: string = "boolKey";
|
@ -11,7 +11,7 @@ if (app.android) {
|
||||
}
|
||||
// << application-app-check
|
||||
|
||||
import * as TKUnit from "./TKUnit";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
|
||||
export var testInitialized = function () {
|
||||
if (platform.device.os === platform.platformNames.android) {
|
@ -1,6 +1,6 @@
|
||||
/* tslint:disable:no-unused-variable */
|
||||
import * as app from "tns-core-modules/application";
|
||||
import * as TKUnit from "./TKUnit";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import * as commonTests from "./application-tests-common";
|
||||
|
||||
global.moduleMerge(commonTests, exports);
|
3
tests/app/application/application-tests.d.ts
vendored
Normal file
3
tests/app/application/application-tests.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/* tslint:disable */
|
||||
import * as android from "./application-tests.android";
|
||||
import * as iOS from "./application-tests.ios";
|
@ -1,6 +1,6 @@
|
||||
/* tslint:disable:no-unused-variable */
|
||||
import * as app from "tns-core-modules/application";
|
||||
import * as TKUnit from "./TKUnit";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import * as commonTests from "./application-tests-common";
|
||||
|
||||
import * as utils from "tns-core-modules/utils/utils";
|
@ -2,7 +2,7 @@
|
||||
import * as colorModule from "tns-core-modules/color";
|
||||
var Color = colorModule.Color;
|
||||
// << color-require
|
||||
import * as TKUnit from "./TKUnit";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
|
||||
export var test_Hex_Color = function () {
|
||||
// >> color-hex
|
@ -1,5 +1,5 @@
|
||||
/* tslint:disable:no-unused-variable */
|
||||
import * as TKUnit from "./TKUnit";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import * as types from "tns-core-modules/utils/types";
|
||||
|
||||
export var test_fetch_defined = function () {
|
@ -3,7 +3,7 @@
|
||||
import * as fs from "tns-core-modules/file-system";
|
||||
// << file-system-require
|
||||
|
||||
import * as TKUnit from "./TKUnit";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import * as appModule from "tns-core-modules/application";
|
||||
import * as platform from "tns-core-modules/platform";
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* tslint:disable:no-unused-variable */
|
||||
import * as TKUnit from "./TKUnit";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import * as http from "tns-core-modules/http";
|
||||
import * as types from "tns-core-modules/utils/types";
|
||||
import * as fs from "tns-core-modules/file-system";
|
@ -9,20 +9,17 @@
|
||||
import * as imageSource from "tns-core-modules/image-source";
|
||||
import * as fs from "tns-core-modules/file-system";
|
||||
import * as app from "tns-core-modules/application";
|
||||
import * as TKUnit from "./TKUnit";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import * as platform from "tns-core-modules/platform";
|
||||
|
||||
var imagePath = fs.path.join(__dirname, "/logo.png");
|
||||
var smallImagePath = fs.path.join(__dirname, "/small-image.png");
|
||||
var imagePath = "~/logo.png";
|
||||
var smallImagePath = "~/small-image.png";
|
||||
|
||||
/* TODO: We need a way to programmatically add an image to resources and then load it from, otherwise we do not know if there is such resource in the target native app.
|
||||
export function testFromResource() {
|
||||
// >> imagesource-resname
|
||||
var img = imageSource.fromResource("logo");
|
||||
// << imagesource-resname
|
||||
var img = imageSource.fromResource("icon");
|
||||
TKUnit.assert(img.height > 0, "image.fromResource failed");
|
||||
}
|
||||
*/
|
||||
|
||||
export function testFromUrl(done) {
|
||||
//var completed;
|
||||
var result: imageSource.ImageSource;
|
@ -1,4 +1,4 @@
|
||||
import * as TKUnit from "./TKUnit";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import * as app from "tns-core-modules/application";
|
||||
import { isIOS, isAndroid } from "tns-core-modules/platform";
|
||||
|
@ -8,6 +8,8 @@ import { StackLayout } from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import * as platform from "tns-core-modules/platform";
|
||||
import "./ui-test";
|
||||
import * as fs from "tns-core-modules/file-system";
|
||||
import { unsetValue } from "tns-core-modules/ui/core/properties";
|
||||
import { ad } from "tns-core-modules/utils/utils";
|
||||
|
||||
Frame.defaultAnimatedNavigation = false;
|
||||
|
||||
@ -29,80 +31,206 @@ export function isRunningOnEmulator(): boolean {
|
||||
|
||||
export var allTests = {};
|
||||
|
||||
allTests["PLATFORM"] = require("./platform-tests");
|
||||
allTests["FILE SYSTEM"] = require("./file-system-tests");
|
||||
allTests["HTTP"] = require("./http-tests");
|
||||
allTests["XHR"] = require("./xhr-tests");
|
||||
allTests["FETCH"] = require("./fetch-tests");
|
||||
allTests["APPLICATION SETTINGS"] = require("./application-settings-tests");
|
||||
allTests["APPLICATION"] = require("./application-tests");
|
||||
allTests["IMAGE SOURCE"] = require("./image-source-tests");
|
||||
allTests["OBSERVABLE-ARRAY"] = require("./data/observable-array-tests");
|
||||
allTests["VIRTUAL-ARRAY"] = require("./data/virtual-array-tests");
|
||||
allTests["OBSERVABLE"] = require("./data/observable-tests");
|
||||
allTests["TIMER"] = require("./timer-tests");
|
||||
allTests["COLOR"] = require("./color-tests");
|
||||
import * as platformTests from "./platform/platform-tests";
|
||||
allTests["PLATFORM"] = platformTests;
|
||||
|
||||
// allTests["DEPENDENCY-OBSERVABLE"] = require("./ui/dependency-observable-tests");
|
||||
allTests["BINDABLE"] = require("./ui/bindable-tests");
|
||||
allTests["BINDING-EXPRESSIONS"] = require("./ui/binding-expressions-tests");
|
||||
allTests["XML-PARSER"] = require("./xml-parser-tests/xml-parser-tests");
|
||||
allTests["FORMATTEDSTRING"] = require("./text/formatted-string-tests");
|
||||
allTests["FILE-SYSTEM-ACCESS"] = require("./file-system-access-tests/file-system-access-tests");
|
||||
allTests["FILE-NAME-RESOLVER"] = require("./file-name-resolver-tests/file-name-resolver-tests");
|
||||
allTests["WEAK-EVENTS"] = require("./weak-event-listener-tests");
|
||||
allTests["CONNECTIVITY"] = require("./connectivity-tests");
|
||||
import * as fsTests from "./file-system/file-system-tests";
|
||||
allTests["FILE SYSTEM"] = fsTests;
|
||||
|
||||
allTests["PROXY-VIEW-CONTAINER"] = require("./ui/proxy-view-container/proxy-view-container-tests")
|
||||
allTests["SCROLL-VIEW"] = require("./ui/scroll-view/scroll-view-tests");
|
||||
allTests["ACTION-BAR"] = require("./ui/action-bar/action-bar-tests");
|
||||
allTests["XML-DECLARATION"] = require("./xml-declaration/xml-declaration-tests");
|
||||
allTests["DOCKLAYOUT"] = require("./ui/layouts/dock-layout-tests");
|
||||
allTests["WRAPLAYOUT"] = require("./ui/layouts/wrap-layout-tests");
|
||||
allTests["ABSOLUTELAYOUT"] = require("./ui/layouts/absolute-layout-tests");
|
||||
allTests["GRIDLAYOUT"] = require("./ui/layouts/grid-layout-tests");
|
||||
allTests["STACKLAYOUT"] = require("./ui/layouts/stack-layout-tests");
|
||||
allTests["FLEXBOXLAYOUT"] = require("./ui/layouts/flexbox-layout-tests");
|
||||
allTests["STYLE-PROPERTIES"] = require("./ui/styling/style-properties-tests");
|
||||
allTests["FRAME"] = require("./ui/frame/frame-tests");
|
||||
allTests["VIEW"] = require("./ui/view/view-tests");
|
||||
allTests["STYLE"] = require("./ui/styling/style-tests");
|
||||
allTests["VISUAL-STATE"] = require("./ui/styling/visual-state-tests");
|
||||
allTests["VALUE-SOURCE"] = require("./ui/styling/value-source-tests");
|
||||
allTests["CSS-SELECTOR-PARSER"] = require("./ui/styling/css-selector-parser");
|
||||
allTests["CSS-SELECTOR"] = require("./ui/styling/css-selector");
|
||||
allTests["BUTTON"] = require("./ui/button/button-tests");
|
||||
allTests["BORDER"] = require("./ui/border/border-tests");
|
||||
allTests["LABEL"] = require("./ui/label/label-tests");
|
||||
allTests["TAB-VIEW"] = require("./ui/tab-view/tab-view-tests");
|
||||
allTests["TAB-VIEW-NAVIGATION"] = require("./ui/tab-view/tab-view-navigation-tests");
|
||||
allTests["IMAGE"] = require("./ui/image/image-tests");
|
||||
allTests["SLIDER"] = require("./ui/slider/slider-tests");
|
||||
allTests["SWITCH"] = require("./ui/switch/switch-tests");
|
||||
allTests["PROGRESS"] = require("./ui/progress/progress-tests");
|
||||
allTests["PLACEHOLDER"] = require("./ui/placeholder/placeholder-tests");
|
||||
allTests["PAGE"] = require("./ui/page/page-tests");
|
||||
allTests["LISTVIEW"] = require("./ui/list-view/list-view-tests");
|
||||
allTests["ACTIVITY-INDICATOR"] = require("./ui/activity-indicator/activity-indicator-tests");
|
||||
allTests["TEXT-FIELD"] = require("./ui/text-field/text-field-tests");
|
||||
allTests["TEXT-VIEW"] = require("./ui/text-view/text-view-tests");
|
||||
allTests["LIST-PICKER"] = require("./ui/list-picker/list-picker-tests");
|
||||
allTests["DATE-PICKER"] = require("./ui/date-picker/date-picker-tests");
|
||||
allTests["TIME-PICKER"] = require("./ui/time-picker/time-picker-tests");
|
||||
allTests["WEB-VIEW"] = require("./ui/web-view/web-view-tests");
|
||||
allTests["HTML-VIEW"] = require("./ui/html-view/html-view-tests");
|
||||
allTests["REPEATER"] = require("./ui/repeater/repeater-tests");
|
||||
allTests["SEARCH-BAR"] = require('./ui/search-bar/search-bar-tests');
|
||||
allTests["SEGMENTED-BAR"] = require("./ui/segmented-bar/segmented-bar-tests");
|
||||
allTests["ANIMATION"] = require("./ui/animation/animation-tests");
|
||||
allTests["CSS-ANIMATION"] = require("./ui/animation/css-animation-tests");
|
||||
import * as httpTests from "./http/http-tests";
|
||||
allTests["HTTP"] = httpTests;
|
||||
|
||||
import * as xhrTests from "./xhr/xhr-tests";
|
||||
allTests["XHR"] = xhrTests;
|
||||
|
||||
import * as fetchTests from "./fetch/fetch-tests";
|
||||
allTests["FETCH"] = fetchTests;
|
||||
|
||||
import * as appSettingsTests from "./application-settings/application-settings-tests";
|
||||
allTests["APPLICATION SETTINGS"] = appSettingsTests;
|
||||
|
||||
import * as applicationTests from "./application/application-tests";
|
||||
allTests["APPLICATION"] = applicationTests;
|
||||
|
||||
import * as imageSourceTests from "./image-source/image-source-tests";
|
||||
allTests["IMAGE SOURCE"] = imageSourceTests;
|
||||
|
||||
import * as observableArrayTests from "./data/observable-array-tests";
|
||||
allTests["OBSERVABLE-ARRAY"] = observableArrayTests;
|
||||
|
||||
import * as virtualArrayTests from "./data/virtual-array-tests";
|
||||
allTests["VIRTUAL-ARRAY"] = virtualArrayTests;
|
||||
|
||||
import * as observableTests from "./data/observable-tests";
|
||||
allTests["OBSERVABLE"] = observableTests;
|
||||
|
||||
import * as timerTests from "./timer/timer-tests";
|
||||
allTests["TIMER"] = timerTests;
|
||||
|
||||
import * as colorTests from "./color/color-tests";
|
||||
allTests["COLOR"] = colorTests;
|
||||
|
||||
import * as bindableTests from "./ui/core/bindable/bindable-tests";
|
||||
allTests["BINDABLE"] = bindableTests;
|
||||
|
||||
import * as bindintExpressionTests from "./ui/core/bindable/binding-expressions-tests";
|
||||
allTests["BINDING-EXPRESSIONS"] = bindintExpressionTests;
|
||||
|
||||
import * as xmlParserTests from "./xml-parser-tests/xml-parser-tests";
|
||||
allTests["XML-PARSER"] = xmlParserTests;
|
||||
|
||||
import * as formattedStringTests from "./text/formatted-string-tests";
|
||||
allTests["FORMATTEDSTRING"] = formattedStringTests;
|
||||
|
||||
import * as fileSystemAccessTests from "./file-system-access-tests/file-system-access-tests";
|
||||
allTests["FILE-SYSTEM-ACCESS"] = fileSystemAccessTests;
|
||||
|
||||
import * as fileNameResolverTests from "./file-name-resolver-tests/file-name-resolver-tests";
|
||||
allTests["FILE-NAME-RESOLVER"] = fileNameResolverTests;
|
||||
|
||||
import * as weakEventsTests from "./ui/core/weak-event-listener/weak-event-listener-tests";
|
||||
allTests["WEAK-EVENTS"] = weakEventsTests;
|
||||
|
||||
import * as connectivityTests from "./connectivity/connectivity-tests";
|
||||
allTests["CONNECTIVITY"] = connectivityTests;
|
||||
|
||||
import * as proxyViewContainerTests from "./ui/proxy-view-container/proxy-view-container-tests";
|
||||
allTests["PROXY-VIEW-CONTAINER"] = proxyViewContainerTests;
|
||||
|
||||
import * as scrollViewTests from "./ui/scroll-view/scroll-view-tests";
|
||||
allTests["SCROLL-VIEW"] = scrollViewTests;
|
||||
|
||||
import * as actionBarTests from "./ui/action-bar/action-bar-tests";
|
||||
allTests["ACTION-BAR"] = actionBarTests;
|
||||
|
||||
import * as xmlDeclarationTests from "./xml-declaration/xml-declaration-tests";
|
||||
allTests["XML-DECLARATION"] = xmlDeclarationTests;
|
||||
|
||||
import * as dockLayoutTests from "./ui/layouts/dock-layout-tests";
|
||||
allTests["DOCKLAYOUT"] = dockLayoutTests;
|
||||
|
||||
import * as wrapLayoutTests from "./ui/layouts/wrap-layout-tests";
|
||||
allTests["WRAPLAYOUT"] = wrapLayoutTests;
|
||||
|
||||
import * as absoluteLayoutTests from "./ui/layouts/absolute-layout-tests";
|
||||
allTests["ABSOLUTELAYOUT"] = absoluteLayoutTests;
|
||||
|
||||
import * as gridLayoutTests from "./ui/layouts/grid-layout-tests";
|
||||
allTests["GRIDLAYOUT"] = gridLayoutTests;
|
||||
|
||||
import * as stackLayoutTests from "./ui/layouts/stack-layout-tests";
|
||||
allTests["STACKLAYOUT"] = stackLayoutTests;
|
||||
|
||||
import * as flexBoxLayoutTests from "./ui/layouts/flexbox-layout-tests";
|
||||
allTests["FLEXBOXLAYOUT"] = flexBoxLayoutTests;
|
||||
|
||||
import * as stylePropertiesTests from "./ui/styling/style-properties-tests";
|
||||
allTests["STYLE-PROPERTIES"] = stylePropertiesTests;
|
||||
|
||||
import * as frameTests from "./ui/frame/frame-tests";
|
||||
allTests["FRAME"] = frameTests;
|
||||
|
||||
import * as viewTests from "./ui/view/view-tests";
|
||||
allTests["VIEW"] = viewTests;
|
||||
|
||||
import * as styleTests from "./ui/styling/style-tests";
|
||||
allTests["STYLE"] = styleTests;
|
||||
|
||||
import * as visualStateTests from "./ui/styling/visual-state-tests";
|
||||
allTests["VISUAL-STATE"] = visualStateTests;
|
||||
|
||||
import * as valueSourceTests from "./ui/styling/value-source-tests";
|
||||
allTests["VALUE-SOURCE"] = valueSourceTests;
|
||||
|
||||
import * as cssSelectorParserTests from "./ui/styling/css-selector-parser";
|
||||
allTests["CSS-SELECTOR-PARSER"] = cssSelectorParserTests;
|
||||
|
||||
import * as cssSelectorTests from "./ui/styling/css-selector";
|
||||
allTests["CSS-SELECTOR"] = cssSelectorTests;
|
||||
|
||||
import * as buttonTests from "./ui/button/button-tests";
|
||||
allTests["BUTTON"] = buttonTests;
|
||||
|
||||
import * as borderTests from "./ui/border/border-tests";
|
||||
allTests["BORDER"] = borderTests;
|
||||
|
||||
import * as labelTests from "./ui/label/label-tests";
|
||||
allTests["LABEL"] = labelTests;
|
||||
|
||||
import * as tabViewTests from "./ui/tab-view/tab-view-tests";
|
||||
allTests["TAB-VIEW"] = tabViewTests;
|
||||
|
||||
import * as tabViewNavigationTests from "./ui/tab-view/tab-view-navigation-tests";
|
||||
allTests["TAB-VIEW-NAVIGATION"] = tabViewNavigationTests;
|
||||
|
||||
import * as imageTests from "./ui/image/image-tests";
|
||||
allTests["IMAGE"] = imageTests;
|
||||
|
||||
import * as sliderTests from "./ui/slider/slider-tests";
|
||||
allTests["SLIDER"] = sliderTests;
|
||||
|
||||
import * as switchTests from "./ui/switch/switch-tests";
|
||||
allTests["SWITCH"] = switchTests;
|
||||
|
||||
import * as progressTests from "./ui/progress/progress-tests";
|
||||
allTests["PROGRESS"] = progressTests;
|
||||
|
||||
import * as placeholderTests from "./ui/placeholder/placeholder-tests";
|
||||
allTests["PLACEHOLDER"] = placeholderTests;
|
||||
|
||||
import * as pageTests from "./ui/page/page-tests";
|
||||
allTests["PAGE"] = pageTests;
|
||||
|
||||
import * as listViewTests from "./ui/list-view/list-view-tests";
|
||||
allTests["LISTVIEW"] = listViewTests;
|
||||
|
||||
import * as activityIndicatorTests from "./ui/activity-indicator/activity-indicator-tests";
|
||||
allTests["ACTIVITY-INDICATOR"] = activityIndicatorTests;
|
||||
|
||||
import * as textFieldTests from "./ui/text-field/text-field-tests";
|
||||
allTests["TEXT-FIELD"] = textFieldTests;
|
||||
|
||||
import * as textViewTests from "./ui/text-view/text-view-tests";
|
||||
allTests["TEXT-VIEW"] = textViewTests;
|
||||
|
||||
import * as listPickerTests from "./ui/list-picker/list-picker-tests";
|
||||
allTests["LIST-PICKER"] = listPickerTests;
|
||||
|
||||
import * as datePickerTests from "./ui/date-picker/date-picker-tests";
|
||||
allTests["DATE-PICKER"] = datePickerTests;
|
||||
|
||||
import * as timePickerTests from "./ui/time-picker/time-picker-tests";
|
||||
allTests["TIME-PICKER"] = timePickerTests;
|
||||
|
||||
import * as webViewTests from "./ui/web-view/web-view-tests";
|
||||
allTests["WEB-VIEW"] = webViewTests;
|
||||
|
||||
import * as htmlViewTests from "./ui/html-view/html-view-tests";
|
||||
allTests["HTML-VIEW"] = htmlViewTests;
|
||||
|
||||
import * as repeaterTests from "./ui/repeater/repeater-tests";
|
||||
allTests["REPEATER"] = repeaterTests;
|
||||
|
||||
import * as searchBarTests from "./ui/search-bar/search-bar-tests";
|
||||
allTests["SEARCH-BAR"] = searchBarTests;
|
||||
|
||||
import * as segmentedBarTests from "./ui/segmented-bar/segmented-bar-tests";
|
||||
allTests["SEGMENTED-BAR"] = segmentedBarTests;
|
||||
|
||||
import * as animationTests from "./ui/animation/animation-tests";
|
||||
allTests["ANIMATION"] = animationTests;
|
||||
|
||||
import * as cssAnimationTests from "./ui/animation/css-animation-tests";
|
||||
allTests["CSS-ANIMATION"] = cssAnimationTests;
|
||||
|
||||
import * as transitionTests from "./navigation/transition-tests";
|
||||
// Skip transitions on android emulators with API 23
|
||||
if (!(platform.device.os === platform.platformNames.android && parseInt(platform.device.sdkVersion) === 23 && isRunningOnEmulator())) {
|
||||
allTests["TANSITIONS"] = require("./navigation/transition-tests");
|
||||
allTests["TANSITIONS"] = transitionTests;
|
||||
}
|
||||
|
||||
allTests["NAVIGATION"] = require("./navigation/navigation-tests");
|
||||
import * as navigationTests from "./navigation/navigation-tests";
|
||||
allTests["NAVIGATION"] = navigationTests;
|
||||
|
||||
var testsWithLongDelay = {
|
||||
test_Transitions: 3 * 60 * 1000,
|
||||
@ -208,7 +336,17 @@ function printRunTestStats() {
|
||||
messageContainer.editable = messageContainer.autocorrect = false;
|
||||
messageContainer.text = finalMessage;
|
||||
stack.addChild(messageContainer);
|
||||
topmost().currentPage.content = stack;
|
||||
const page = topmost().currentPage;
|
||||
page.id = unsetValue;
|
||||
page.className = unsetValue;
|
||||
page.bindingContext = unsetValue;
|
||||
page.style.color = unsetValue;
|
||||
page.style.backgroundColor = unsetValue;
|
||||
page.content = stack;
|
||||
messageContainer.focus();
|
||||
if (page.android) {
|
||||
setTimeout(() => messageContainer.dismissSoftInput());
|
||||
}
|
||||
}
|
||||
|
||||
function startLog(): void {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import * as TKUnit from "./TKUnit";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import * as timer from "tns-core-modules/timer";
|
||||
|
||||
// >> timer-require
|
@ -1,7 +1,6 @@
|
||||
import * as TKUnit from "../../TKUnit";
|
||||
import * as helper from "../helper";
|
||||
import * as builder from "tns-core-modules/ui/builder";
|
||||
import * as fs from "tns-core-modules/file-system";
|
||||
import { Label } from "tns-core-modules/ui/label";
|
||||
import { Button } from "tns-core-modules/ui/button";
|
||||
import { Page } from "tns-core-modules/ui/page";
|
||||
@ -212,10 +211,8 @@ export function test_Setting_ActionItemsWithNumberAsText_doesnt_thrown() {
|
||||
|
||||
let gotException = false;
|
||||
|
||||
const moduleName = __dirname.substr(fs.knownFolders.currentApp().path.length);
|
||||
|
||||
try {
|
||||
helper.navigateToModule(moduleName + "/ActionBar_NumberAsText");
|
||||
helper.navigateToModule("ui/action-bar/ActionBar_NumberAsText");
|
||||
}
|
||||
catch (e) {
|
||||
gotException = true;
|
||||
@ -225,8 +222,8 @@ export function test_Setting_ActionItemsWithNumberAsText_doesnt_thrown() {
|
||||
}
|
||||
|
||||
export function test_CanDefineEverythingAsContentBetweenTheTwoTags() {
|
||||
const moduleName = __dirname.substr(fs.knownFolders.currentApp().path.length);
|
||||
helper.navigateToModuleAndRunTest(moduleName + "/ActionBar_BetweenTags", undefined, (page: Page) => {
|
||||
|
||||
helper.navigateToModuleAndRunTest("ui/action-bar/ActionBar_BetweenTags", undefined, (page: Page) => {
|
||||
|
||||
TKUnit.assertNotNull(page.actionBar.navigationButton);
|
||||
TKUnit.assertEqual(page.actionBar.navigationButton.text, "nb");
|
||||
|
3
tests/app/ui/action-bar/action-bar-tests.d.ts
vendored
Normal file
3
tests/app/ui/action-bar/action-bar-tests.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/* tslint:disable */
|
||||
import * as android from "./action-bar-tests.android";
|
||||
import * as iOS from "./action-bar-tests.ios";
|
@ -1,4 +1,5 @@
|
||||
// >> border-require
|
||||
var borderModule = require("ui/border");
|
||||
import { Border } from "tns-core-modules/ui/border";
|
||||
// << border-require
|
||||
console.dir(borderModule);
|
||||
|
||||
console.dir(Border);
|
@ -1,12 +1,11 @@
|
||||
import { Observable, fromObject, fromObjectRecursive } from "tns-core-modules/data/observable";
|
||||
import { ViewBase } from "tns-core-modules/ui/core/view-base";
|
||||
import { BindingOptions } from "tns-core-modules/ui/core/bindable";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import * as TKUnit from "../../../TKUnit";
|
||||
import * as types from "tns-core-modules/utils/types";
|
||||
import * as helper from "../ui/helper";
|
||||
import * as helper from "../../helper";
|
||||
import * as utils from "tns-core-modules/utils/utils";
|
||||
import * as bindingBuilder from "tns-core-modules/ui/builder/binding-builder";
|
||||
import * as fs from "tns-core-modules/file-system";
|
||||
import * as appModule from "tns-core-modules/application";
|
||||
import * as trace from "tns-core-modules/trace";
|
||||
import { View } from "tns-core-modules/ui/core/view";
|
||||
@ -502,24 +501,22 @@ export function test_TwoElementsBindingToSameBindingContext() {
|
||||
TKUnit.assertEqual(upperStackLabel.text, label1.text, "label1");
|
||||
TKUnit.assertEqual(upperStackLabel.text, label2.text, "label2");
|
||||
};
|
||||
const moduleName = __dirname.substr(fs.knownFolders.currentApp().path.length);
|
||||
helper.navigateToModuleAndRunTest(("." + moduleName + "/bindingContext_testPage"), null, testFunc);
|
||||
helper.navigateToModuleAndRunTest(("ui/core/bindable/bindingContext_testPage"), null, testFunc);
|
||||
};
|
||||
|
||||
export function test_BindingContext_NavigatingForwardAndBack() {
|
||||
const expectedValue = "Tralala";
|
||||
const moduleName = __dirname.substr(fs.knownFolders.currentApp().path.length);
|
||||
const testFunc = function (page: Page) {
|
||||
const innerTestFunc = function (childPage: Page) {
|
||||
const testTextField: TextField = <TextField>(childPage.getViewById("testTextField"));
|
||||
testTextField.text = expectedValue;
|
||||
};
|
||||
helper.navigateToModuleAndRunTest(("." + moduleName + "/bindingContext_testPage2"), page.bindingContext, innerTestFunc);
|
||||
helper.navigateToModuleAndRunTest(("ui/core/bindable/bindingContext_testPage2"), page.bindingContext, innerTestFunc);
|
||||
const testLabel: Label = <Label>(page.getViewById("testLabel"));
|
||||
TKUnit.assertEqual(testLabel.text, expectedValue);
|
||||
};
|
||||
|
||||
helper.navigateToModuleAndRunTest(("." + moduleName + "/bindingContext_testPage1"), null, testFunc);
|
||||
helper.navigateToModuleAndRunTest(("ui/core/bindable/bindingContext_testPage1"), null, testFunc);
|
||||
};
|
||||
|
||||
export function test_BindingToSource_FailsAfterBindingContextChange() {
|
@ -1,7 +1,6 @@
|
||||
import * as frameModule from "tns-core-modules/ui/frame";
|
||||
import * as textFieldModule from "tns-core-modules/ui/text-field";
|
||||
import * as fs from "tns-core-modules/file-system";
|
||||
import * as helper from "../ui/helper";
|
||||
import * as helper from "../../helper";
|
||||
|
||||
export var test_BindingExpressions_ArrayAccess = function () {
|
||||
navigateToPage("bindingExpressions_arrayAccess_testPage");
|
||||
@ -85,6 +84,5 @@ export var assertElementValueIsNaN = function (elementId: string) {
|
||||
}
|
||||
|
||||
export var navigateToPage = function (pageName: string) {
|
||||
var path = __dirname.substr(fs.knownFolders.currentApp().path.length);
|
||||
helper.navigateToModule(path + "/test-pages/" + pageName);
|
||||
helper.navigateToModule("/ui/test-pages/" + pageName);
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
import * as TKUnit from "./TKUnit";
|
||||
import * as TKUnit from "../../../TKUnit";
|
||||
import { Observable, EventData } from "tns-core-modules/data/observable";
|
||||
import { addWeakEventListener, removeWeakEventListener } from "tns-core-modules/ui/core/weak-event-listener";
|
||||
import { forceGC } from "./ui/helper";
|
||||
import { forceGC } from "../../helper";
|
||||
|
||||
class Target {
|
||||
public counter: number = 0;
|
3
tests/app/ui/frame/frame-tests.d.ts
vendored
Normal file
3
tests/app/ui/frame/frame-tests.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/* tslint:disable */
|
||||
import * as android from "./frame-tests.android";
|
||||
import * as iOS from "./frame-tests.ios";
|
3
tests/app/ui/page/page-tests.d.ts
vendored
Normal file
3
tests/app/ui/page/page-tests.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/* tslint:disable */
|
||||
import * as android from "./page-tests.android";
|
||||
import * as iOS from "./page-tests.ios";
|
@ -5,7 +5,6 @@ import * as viewModule from "tns-core-modules/ui/core/view";
|
||||
import * as stackLayoutModule from "tns-core-modules/ui/layouts/stack-layout";
|
||||
import * as wrapLayoutModule from "tns-core-modules/ui/layouts/wrap-layout";
|
||||
import * as layoutBaseModule from "tns-core-modules/ui/layouts/layout-base";
|
||||
import * as fs from "tns-core-modules/file-system";
|
||||
import * as pageModule from "tns-core-modules/ui/page";
|
||||
import * as gestureModule from "tns-core-modules/ui/gestures";
|
||||
import { Label } from "tns-core-modules/ui/label";
|
||||
@ -201,17 +200,13 @@ export function test_add_to_observable_array_refreshes_the_Repeater() {
|
||||
var colors = new observableArray.ObservableArray(["red", "green", "blue"]);
|
||||
repeater.items = colors;
|
||||
|
||||
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
|
||||
TKUnit.assertEqual(getChildrenCount(repeater), 3, "getChildrenCount");
|
||||
|
||||
// >> article-push-to-observablearray
|
||||
colors.push("yellow");
|
||||
// The Repeater will be updated automatically.
|
||||
// << article-push-to-observablearray
|
||||
TKUnit.wait(ASYNC);
|
||||
TKUnit.waitUntilReady(() => repeater.isLayoutValid);
|
||||
TKUnit.assertEqual(getChildrenCount(repeater), 4, "getChildrenCount");
|
||||
|
||||
};
|
||||
|
||||
helper.buildUIAndRunTest(repeater, testAction);
|
||||
@ -363,8 +358,7 @@ export var test_RepeaterItemsGestureBindings = function () {
|
||||
TKUnit.assertEqual(hasObservers, true, "Every item should have tap observer!");
|
||||
}
|
||||
|
||||
var moduleName = __dirname.substr(fs.knownFolders.currentApp().path.length);
|
||||
helper.navigateToModuleAndRunTest(("." + moduleName + "/repeaterItems-bindingToGestures"), null, testFunc);
|
||||
helper.navigateToModuleAndRunTest("ui/repeater/repeaterItems-bindingToGestures", null, testFunc);
|
||||
}
|
||||
|
||||
export var test_RepeaterItemsParentBindingsShouldWork = function () {
|
||||
@ -390,8 +384,7 @@ export var test_RepeaterItemsParentBindingsShouldWork = function () {
|
||||
TKUnit.assertEqual(testPass, true, "Every item should have text bound to Page binding context!");
|
||||
}
|
||||
|
||||
var moduleName = __dirname.substr(fs.knownFolders.currentApp().path.length);
|
||||
helper.navigateToModuleAndRunTest(("." + moduleName + "/repeaterItems-bindingToGestures"), null, testFunc);
|
||||
helper.navigateToModuleAndRunTest("ui/repeater/repeaterItems-bindingToGestures", null, testFunc);
|
||||
}
|
||||
|
||||
export function test_ChildrenAreNotCreatedUntilTheRepeaterIsLoaded() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* tslint:disable:no-unused-variable */
|
||||
import * as TKUnit from "./TKUnit";
|
||||
import * as TKUnit from "../TKUnit";
|
||||
import * as types from "tns-core-modules/utils/types";
|
||||
|
||||
export var test_XMLHttpRequest_isDefined = function () {
|
@ -902,10 +902,10 @@ export function test_TabViewHasCorrectParentChain() {
|
||||
var testFunc = function (page: Page) {
|
||||
TKUnit.assert(page.bindingContext.get("testPassed"));
|
||||
}
|
||||
var moduleName = __dirname.substr(fs.knownFolders.currentApp().path.length);
|
||||
|
||||
var model = new Observable();
|
||||
model.set("testPassed", false);
|
||||
helper.navigateToModuleAndRunTest(("." + moduleName + "/mymodulewithxml/TabViewParentChain"), model, testFunc);
|
||||
helper.navigateToModuleAndRunTest("xml-declaration/mymodulewithxml/TabViewParentChain", model, testFunc);
|
||||
}
|
||||
|
||||
export function test_hasSourceCodeLocations() {
|
||||
|
@ -634,6 +634,11 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
|
||||
}
|
||||
|
||||
public _tearDownUI(force?: boolean) {
|
||||
// No context means we are already teared down.
|
||||
if (!this._context) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (traceEnabled()) {
|
||||
traceWrite(`${this}._tearDownUI(${force})`, traceCategories.VisualTreeEvents);
|
||||
}
|
||||
|
Reference in New Issue
Block a user