mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: cleanup
This commit is contained in:
@@ -43,5 +43,14 @@
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
<key>NSAllowsArbitraryLoadsForMedia</key>
|
||||
<true/>
|
||||
<key>NSAllowsArbitraryLoadsInWebContent</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
// >> observable-require
|
||||
import { Observable, fromObject, fromObjectRecursive, PropertyChangeData, EventData, WrappedValue } from "@nativescript/core/data/observable";
|
||||
import { Observable, PropertyChangeData, EventData, WrappedValue, fromObject, fromObjectRecursive } from "@nativescript/core";
|
||||
// << observable-require
|
||||
|
||||
import * as TKUnit from "../tk-unit";
|
||||
import * as types from "@nativescript/core/utils/types";
|
||||
import { ObservableArray } from "@nativescript/core/data/observable-array";
|
||||
import { ObservableArray } from "@nativescript/core";
|
||||
|
||||
var TESTED_NAME = "tested";
|
||||
class TestObservable extends Observable {
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
import * as TKUnit from "../tk-unit";
|
||||
import * as fs from "@nativescript/core/file-system";
|
||||
import { knownFolders, path, File, Folder } from "@nativescript/core";
|
||||
|
||||
export var test_UTF8_BOM_is_not_returned = function () {
|
||||
var path = fs.path.join(fs.knownFolders.currentApp().path, "file-system-access-tests", "xml.expected");
|
||||
if (!fs.File.exists(path)) {
|
||||
TKUnit.assert(false, "Could not read file utf8.txt");
|
||||
|
||||
return;
|
||||
const folder1 = path.join(knownFolders.documents().path, "file-system-access-tests");
|
||||
if (!Folder.exists(folder1)) {
|
||||
Folder.fromPath(folder1);
|
||||
}
|
||||
|
||||
var file = fs.File.fromPath(path);
|
||||
var filePath = path.join(folder1, "xml.expected");
|
||||
var file = File.fromPath(filePath);
|
||||
|
||||
var onError = function (error) {
|
||||
TKUnit.assert(false, "Could not read file utf8.txt");
|
||||
TKUnit.assert(false, "Could not read file xml.expected");
|
||||
};
|
||||
|
||||
var text = file.readTextSync(onError);
|
||||
@@ -24,21 +22,28 @@ export var test_UTF8_BOM_is_not_returned = function () {
|
||||
};
|
||||
|
||||
export var test_file_exists_on_folder = function () {
|
||||
var path = fs.path.join(fs.knownFolders.currentApp().path, "file-system-access-tests", "folder");
|
||||
const folder1 = path.join(knownFolders.documents().path, "file-system-access-tests");
|
||||
if (!Folder.exists(folder1)) {
|
||||
Folder.fromPath(folder1);
|
||||
}
|
||||
var filePath = path.join(folder1, "folder");
|
||||
if (!Folder.exists(filePath)) {
|
||||
Folder.fromPath(filePath);
|
||||
}
|
||||
|
||||
if (!fs.Folder.exists(path)) {
|
||||
TKUnit.assert(false, `Could not read path ${path}`);
|
||||
if (!Folder.exists(filePath)) {
|
||||
TKUnit.assert(false, `Could not read path ${filePath}`);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
TKUnit.assertTrue(fs.File.exists(path), "File.exists() returned false for folder!");
|
||||
TKUnit.assertTrue(File.exists(filePath), "File.exists() returned false for folder!");
|
||||
};
|
||||
|
||||
export var test_leading_slash_is_not_returned = function () {
|
||||
var parts = ["app", "tns_modules", "fileName"];
|
||||
var expected = parts.join("/");
|
||||
var path = fs.path.join(...parts);
|
||||
var filePath = path.join(...parts);
|
||||
|
||||
TKUnit.assertEqual(path, expected, "Leading slash should not be part of the path");
|
||||
TKUnit.assertEqual(filePath, expected, "Leading slash should not be part of the path");
|
||||
};
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
import * as TKUnit from "../tk-unit";
|
||||
import * as fs from "@nativescript/core/file-system";
|
||||
import { FileNameResolver } from "@nativescript/core/file-system/file-name-resolver";
|
||||
import {
|
||||
androidPhonePortraitContext,
|
||||
androidPhoneLandscapeContext,
|
||||
androidTabletPortraitContext,
|
||||
iPhoneLandscapeContext,
|
||||
iPhonePortraitContext
|
||||
} from "./qualifier-matcher-tests";
|
||||
|
||||
const testFilePath = "~/name-resolvers-tests/files/test".replace("~", fs.knownFolders.currentApp().path);
|
||||
|
||||
export function test_file_resolver_with_android_phone_portrait() {
|
||||
const fileResolver = new FileNameResolver(androidPhonePortraitContext);
|
||||
const result = fileResolver.resolveFileName(testFilePath, "xml");
|
||||
TKUnit.assertEqual(result, testFilePath + ".xml", "File path");
|
||||
}
|
||||
|
||||
export function test_file_resolver_with_android_phone_landscape() {
|
||||
const fileResolver = new FileNameResolver(androidPhoneLandscapeContext);
|
||||
const result = fileResolver.resolveFileName(testFilePath, "xml");
|
||||
TKUnit.assertEqual(result, testFilePath + ".land.xml", "File path");
|
||||
}
|
||||
|
||||
export function test_file_resolver_with_android_tablet_portrait() {
|
||||
const fileResolver = new FileNameResolver(androidTabletPortraitContext);
|
||||
const result = fileResolver.resolveFileName(testFilePath, "xml");
|
||||
TKUnit.assertEqual(result, testFilePath + ".minWH600.xml", "File path");
|
||||
}
|
||||
|
||||
export function test_file_resolver_with_ios_phone_landscape() {
|
||||
const fileResolver = new FileNameResolver(iPhoneLandscapeContext);
|
||||
const result = fileResolver.resolveFileName(testFilePath, "xml");
|
||||
TKUnit.assertEqual(result, testFilePath + ".land.xml", "File path");
|
||||
}
|
||||
|
||||
export function test_file_resolver_with_ios_phone_portrait() {
|
||||
const fileResolver = new FileNameResolver(iPhonePortraitContext);
|
||||
const result = fileResolver.resolveFileName(testFilePath, "xml");
|
||||
TKUnit.assertEqual(result, testFilePath + ".xml", "File path");
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as TKUnit from "../tk-unit";
|
||||
import { ModuleNameResolver, ModuleListProvider } from "@nativescript/core/module-name-resolver";
|
||||
import { ModuleNameResolver, ModuleListProvider } from "@nativescript/core";
|
||||
|
||||
import {
|
||||
androidPhonePortraitContext,
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import * as label from "@nativescript/core/ui/label";
|
||||
import * as pages from "@nativescript/core/ui/page";
|
||||
import * as fs from "@nativescript/core/file-system";
|
||||
import * as fileResolverModule from "@nativescript/core/file-system/file-name-resolver";
|
||||
import { Page, Label, knownFolders, path, ModuleNameResolver } from "@nativescript/core";
|
||||
|
||||
export function createPage() {
|
||||
var page = new pages.Page();
|
||||
var lbl = new label.Label();
|
||||
var page = new Page();
|
||||
var lbl = new Label();
|
||||
|
||||
var moduleName = "tests/pages/files/test";
|
||||
|
||||
var resolver = new fileResolverModule.FileNameResolver({
|
||||
ModuleNameResolver
|
||||
var resolver = new ModuleNameResolver({
|
||||
width: 400,
|
||||
height: 600,
|
||||
os: "android",
|
||||
@@ -17,8 +15,8 @@ export function createPage() {
|
||||
});
|
||||
|
||||
// Current app full path.
|
||||
var currentAppPath = fs.knownFolders.currentApp().path;
|
||||
var moduleNamePath = fs.path.join(currentAppPath, moduleName);
|
||||
var currentAppPath = knownFolders.currentApp().path;
|
||||
var moduleNamePath = path.join(currentAppPath, moduleName);
|
||||
|
||||
var fileName = resolver.resolveFileName(moduleNamePath, "xml");
|
||||
lbl.text = fileName;
|
||||
|
||||
@@ -2,29 +2,20 @@
|
||||
import * as TKUnit from './tk-unit';
|
||||
import './ui-test';
|
||||
|
||||
import { _resetRootView } from '@nativescript/core/application';
|
||||
import * as platform from '@nativescript/core/platform';
|
||||
import { Trace } from '@nativescript/core/trace';
|
||||
import { Button } from '@nativescript/core/ui/button';
|
||||
import { Frame } from '@nativescript/core/ui/frame';
|
||||
import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
|
||||
import { Page } from '@nativescript/core/ui/page';
|
||||
import { TextView } from '@nativescript/core/ui/text-view';
|
||||
import { ios } from '@nativescript/core/utils';
|
||||
|
||||
import { isIOS, Application, Device, platformNames, Trace, Button, Frame, StackLayout, Page, TextView, Utils } from '@nativescript/core';
|
||||
Frame.defaultAnimatedNavigation = false;
|
||||
|
||||
export function isRunningOnEmulator(): boolean {
|
||||
// These checks are not good enough to be added to modules but they keep unit tests green.
|
||||
|
||||
if (platform.Device.os === platform.platformNames.android) {
|
||||
if (Device.os === platformNames.android) {
|
||||
return android.os.Build.FINGERPRINT.indexOf("generic") > -1 ||
|
||||
android.os.Build.HARDWARE.toLowerCase() === "goldfish" ||
|
||||
android.os.Build.HARDWARE.toLowerCase() === "donatello" || // VS Emulator
|
||||
android.os.Build.PRODUCT.toLocaleLowerCase().indexOf("sdk") > -1 ||
|
||||
android.os.Build.PRODUCT.toLocaleLowerCase().indexOf("emulator") > -1; // VS Emulator
|
||||
}
|
||||
else if (platform.Device.os === platform.platformNames.ios) {
|
||||
else if (Device.os === platformNames.ios) {
|
||||
return (__dirname.search("Simulator") > -1);
|
||||
}
|
||||
}
|
||||
@@ -102,9 +93,6 @@ allTests["FILE-SYSTEM-ACCESS"] = fileSystemAccessTests;
|
||||
import * as qualifierMatcherTests from "./name-resolvers-tests/qualifier-matcher-tests";
|
||||
allTests["QUALIFIER-MATCHER"] = qualifierMatcherTests;
|
||||
|
||||
import * as fileNameResolverTests from "./name-resolvers-tests/file-name-resolver-tests";
|
||||
allTests["FILE-NAME-RESOLVER"] = fileNameResolverTests;
|
||||
|
||||
import * as moduleNameResolverTests from "./name-resolvers-tests/module-name-resolver-tests";
|
||||
allTests["MODULE-NAME-RESOLVER"] = moduleNameResolverTests;
|
||||
|
||||
@@ -154,7 +142,7 @@ import * as scrollViewSafeAreaTests from "./ui/scroll-view/scroll-view-safe-area
|
||||
import * as repeaterSafeAreaTests from "./ui/repeater/repeater-safe-area-tests";
|
||||
import * as webViewSafeAreaTests from "./ui/web-view/web-view-safe-area-tests";
|
||||
|
||||
if (platform.isIOS && ios.MajorVersion > 10) {
|
||||
if (isIOS && Utils.ios.MajorVersion > 10) {
|
||||
allTests["SAFEAREALAYOUT"] = safeAreaLayoutTests;
|
||||
allTests["SAFEAREA-LISTVIEW"] = safeAreaListViewtTests;
|
||||
allTests["SAFEAREA-SCROLL-VIEW"] = scrollViewSafeAreaTests;
|
||||
@@ -186,9 +174,6 @@ allTests["VISUAL-STATE"] = visualStateTests;
|
||||
import * as valueSourceTests from "./ui/styling/value-source-tests";
|
||||
allTests["VALUE-SOURCE"] = valueSourceTests;
|
||||
|
||||
import * as borderTests from "./ui/border/border-tests";
|
||||
allTests["BORDER"] = borderTests;
|
||||
|
||||
import * as builderTests from "./ui/builder/builder-tests";
|
||||
allTests["BUILDER"] = builderTests;
|
||||
|
||||
@@ -397,7 +382,7 @@ function generateTestFile(allTests: TestInfo[]) {
|
||||
let testName = testCase.testName;
|
||||
let duration = (testCase.duration / 1000).toFixed(2);
|
||||
|
||||
testCases.push(`<testcase classname="${platform.Device.os}" name="${testName}" time="${duration}">`)
|
||||
testCases.push(`<testcase classname="${Device.os}" name="${testName}" time="${duration}">`)
|
||||
if (!testCase.isPassed) {
|
||||
failedTestCount++;
|
||||
testCases.push(`<failure type="exceptions.AssertionError"><![CDATA[${testCase.errorMessage}]]></failure>`)
|
||||
@@ -436,7 +421,7 @@ function showReportPage(finalMessage: string) {
|
||||
page.content = stack;
|
||||
messageContainer.focus();
|
||||
page.style.fontSize = 11;
|
||||
if (platform.isAndroid) {
|
||||
if (isAndroid) {
|
||||
page.on('navigatedTo', () => {
|
||||
messageContainer.focus();
|
||||
setTimeout(() => messageContainer.dismissSoftInput());
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Trace } from "@nativescript/core";
|
||||
|
||||
export var test_DummyTestForSnippetOnly0 = function () {
|
||||
// >> trace-all-categories
|
||||
Trace.setCategories(Trace.categories.All);
|
||||
Trace.setCategories(Trace.categories.All.join(','));
|
||||
Trace.enable();
|
||||
// << trace-all-categories
|
||||
};
|
||||
@@ -20,7 +20,7 @@ export var test_DummyTestForSnippetOnly1 = function () {
|
||||
, Trace.categories.Style
|
||||
, Trace.categories.ViewHierarchy
|
||||
, Trace.categories.VisualTreeEvents
|
||||
));
|
||||
).join(','));
|
||||
Trace.enable();
|
||||
// << trace-specific-categories
|
||||
};
|
||||
|
||||
@@ -137,7 +137,7 @@ export function buildUIWithWeakRefAndInteract<T extends View>(createFunc: () =>
|
||||
// An additional GC and wait are needed since WebKit upgrade to version 12.0
|
||||
// (TEXT-FIELD.testMemoryLeak test started failing sporadically)
|
||||
Utils.GC();
|
||||
TKUnit.wait(0.1);
|
||||
TKUnit.wait(0.2);
|
||||
}
|
||||
Utils.GC();
|
||||
try {
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
// >> border-require
|
||||
import { Border } from "@nativescript/core/ui/border";
|
||||
// << border-require
|
||||
import * as helper from "../../ui-helper";
|
||||
|
||||
export function test_recycling() {
|
||||
helper.nativeView_recycling_test(() => new Border());
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
---
|
||||
nav-title: "Border How-To"
|
||||
title: "border"
|
||||
environment: nativescript
|
||||
description: "Examples for using Border"
|
||||
previous_url: /ApiReference/ui/border/HOW-TO
|
||||
---
|
||||
# Border
|
||||
Using borders requires the Border module.
|
||||
{%snippet border-require%}
|
||||
|
||||
### Declaring a Border.
|
||||
``` XML
|
||||
<Page>
|
||||
<Border borderRadius="10" borderWidth="2" borderColor="#FF0000">
|
||||
<Button text="OK"/>
|
||||
</Border>
|
||||
</Page>
|
||||
```
|
||||
@@ -1,9 +1,6 @@
|
||||
import { Builder } from "@nativescript/core/ui/builder";
|
||||
import { assertEqual, assertNull, assertThrows, assertNotNull, assert } from "../../tk-unit";
|
||||
import { _setResolver, ModuleNameResolver, PlatformContext } from "@nativescript/core/module-name-resolver";
|
||||
import { Button } from "@nativescript/core/ui/button";
|
||||
import { Button, Builder, Page, Color, _setResolver, ModuleNameResolver, PlatformContext } from "@nativescript/core";
|
||||
import { navigate } from "../../ui-helper";
|
||||
import { Page, Color } from "@nativescript/core";
|
||||
|
||||
const testPrefix = "bundle-file-qualifiers-tests";
|
||||
let modulesToCleanup: string[] = [];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Builder } from "@nativescript/core/ui/builder";
|
||||
import { sanitizeModuleName } from "@nativescript/core/ui/builder/module-name-sanitizer";
|
||||
import { Builder, sanitizeModuleName } from "@nativescript/core";
|
||||
|
||||
import { assertEqual, assertNull, assertThrows, assertNotNull } from "../../tk-unit";
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
/* tslint:disable:no-unused-variable */
|
||||
// >> gestures-require
|
||||
import * as gestures from "@nativescript/core/ui/gestures";
|
||||
// << gestures-require
|
||||
import * as labelModule from "@nativescript/core/ui/label";
|
||||
import { GestureEventData, Label, GestureTypes, PanGestureEventData, PinchGestureEventData, SwipeGestureEventData, RotationGestureEventData } from "@nativescript/core";
|
||||
|
||||
export var test_DummyTestForSnippetOnly0 = function () {
|
||||
// >> gestures-double-tap
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on(gestures.GestureTypes.doubleTap, function (args: gestures.GestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on(GestureTypes.doubleTap, function (args: GestureEventData) {
|
||||
console.log("Double Tap");
|
||||
});
|
||||
// << gestures-double-tap
|
||||
@@ -15,8 +12,8 @@ export var test_DummyTestForSnippetOnly0 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly01 = function () {
|
||||
// >> gestures-double-tap-alt
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on("doubleTap", function (args: gestures.GestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on("doubleTap", function (args: GestureEventData) {
|
||||
console.log("Double Tap");
|
||||
});
|
||||
// << gestures-double-tap-alt
|
||||
@@ -24,8 +21,8 @@ export var test_DummyTestForSnippetOnly01 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly1 = function () {
|
||||
// >> gestures-long-press
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on(gestures.GestureTypes.longPress, function (args: gestures.GestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on(GestureTypes.longPress, function (args: GestureEventData) {
|
||||
console.log("Long Press");
|
||||
});
|
||||
// << gestures-long-press
|
||||
@@ -33,8 +30,8 @@ export var test_DummyTestForSnippetOnly1 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly11 = function () {
|
||||
// >> gestures-long-press-alt
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on("longPress", function (args: gestures.GestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on("longPress", function (args: GestureEventData) {
|
||||
console.log("Long Press");
|
||||
});
|
||||
// << gestures-long-press-alt
|
||||
@@ -42,8 +39,8 @@ export var test_DummyTestForSnippetOnly11 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly2 = function () {
|
||||
// >> gestures-pan
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on(gestures.GestureTypes.pan, function (args: gestures.PanGestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on(GestureTypes.pan, function (args: PanGestureEventData) {
|
||||
console.log("Pan deltaX:" + args.deltaX + "; deltaY:" + args.deltaY + ";");
|
||||
});
|
||||
// << gestures-pan
|
||||
@@ -51,8 +48,8 @@ export var test_DummyTestForSnippetOnly2 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly22 = function () {
|
||||
// >> gestures-pan-alt
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on("pan", function (args: gestures.PanGestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on("pan", function (args: PanGestureEventData) {
|
||||
console.log("Pan deltaX:" + args.deltaX + "; deltaY:" + args.deltaY + ";");
|
||||
});
|
||||
// << gestures-pan-alt
|
||||
@@ -60,8 +57,8 @@ export var test_DummyTestForSnippetOnly22 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly3 = function () {
|
||||
// >> gestures-pan-pinch
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on(gestures.GestureTypes.pinch, function (args: gestures.PinchGestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on(GestureTypes.pinch, function (args: PinchGestureEventData) {
|
||||
console.log("Pinch scale: " + args.scale);
|
||||
});
|
||||
// << gestures-pan-pinch
|
||||
@@ -69,8 +66,8 @@ export var test_DummyTestForSnippetOnly3 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly33 = function () {
|
||||
// >> gestures-pan-pinch-alt
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on("pinch", function (args: gestures.PinchGestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on("pinch", function (args: PinchGestureEventData) {
|
||||
console.log("Pinch scale: " + args.scale);
|
||||
});
|
||||
// << gestures-pan-pinch-alt
|
||||
@@ -78,8 +75,8 @@ export var test_DummyTestForSnippetOnly33 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly4 = function () {
|
||||
// >> gestures-rotation
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on(gestures.GestureTypes.rotation, function (args: gestures.RotationGestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on(GestureTypes.rotation, function (args: RotationGestureEventData) {
|
||||
console.log("Rotation: " + args.rotation);
|
||||
});
|
||||
// << gestures-rotation
|
||||
@@ -87,8 +84,8 @@ export var test_DummyTestForSnippetOnly4 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly44 = function () {
|
||||
// >> gestures-rotation-alt
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on("rotation", function (args: gestures.RotationGestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on("rotation", function (args: RotationGestureEventData) {
|
||||
console.log("Rotation: " + args.rotation);
|
||||
});
|
||||
// << gestures-rotation-alt
|
||||
@@ -96,8 +93,8 @@ export var test_DummyTestForSnippetOnly44 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly5 = function () {
|
||||
// >> gestures-swipe
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on(gestures.GestureTypes.swipe, function (args: gestures.SwipeGestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on(GestureTypes.swipe, function (args: SwipeGestureEventData) {
|
||||
console.log("Swipe direction: " + args.direction);
|
||||
});
|
||||
// << gestures-swipe
|
||||
@@ -105,8 +102,8 @@ export var test_DummyTestForSnippetOnly5 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly55 = function () {
|
||||
// >> gestures-swipe-alt
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on("swipe", function (args: gestures.SwipeGestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on("swipe", function (args: SwipeGestureEventData) {
|
||||
console.log("Swipe direction: " + args.direction);
|
||||
});
|
||||
// << gestures-swipe-alt
|
||||
@@ -114,8 +111,8 @@ export var test_DummyTestForSnippetOnly55 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly6 = function () {
|
||||
// >> gestures-tap
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on(gestures.GestureTypes.tap, function (args: gestures.GestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on(GestureTypes.tap, function (args: GestureEventData) {
|
||||
console.log("Tap");
|
||||
});
|
||||
// << gestures-tap
|
||||
@@ -123,8 +120,8 @@ export var test_DummyTestForSnippetOnly6 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly66 = function () {
|
||||
// >> gestures-tap-alt
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on("tap", function (args: gestures.GestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on("tap", function (args: GestureEventData) {
|
||||
console.log("Tap");
|
||||
});
|
||||
// << gestures-tap-alt
|
||||
@@ -132,8 +129,8 @@ export var test_DummyTestForSnippetOnly66 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly7 = function () {
|
||||
// >> gestures-stop-observe
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on(gestures.GestureTypes.tap, function (args: gestures.GestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on(GestureTypes.tap, function (args: GestureEventData) {
|
||||
console.log("Tap");
|
||||
});
|
||||
observer.disconnect();
|
||||
@@ -142,8 +139,8 @@ export var test_DummyTestForSnippetOnly7 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly8 = function () {
|
||||
// >> gestures-multiple
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on(gestures.GestureTypes.tap | gestures.GestureTypes.doubleTap | gestures.GestureTypes.longPress, function (args: gestures.GestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on(GestureTypes.tap | GestureTypes.doubleTap | GestureTypes.longPress, function (args: GestureEventData) {
|
||||
console.log("Event: " + args.eventName);
|
||||
});
|
||||
// << gestures-multiple
|
||||
@@ -151,8 +148,8 @@ export var test_DummyTestForSnippetOnly8 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly88 = function () {
|
||||
// >> gestures-string
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on("tap, doubleTap, longPress", function (args: gestures.GestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on("tap, doubleTap, longPress", function (args: GestureEventData) {
|
||||
console.log("Event: " + args.eventName);
|
||||
});
|
||||
// << gestures-string
|
||||
@@ -160,8 +157,8 @@ export var test_DummyTestForSnippetOnly88 = function () {
|
||||
|
||||
export var test_DummyTestForSnippetOnly9 = function () {
|
||||
// >> gestures-events-string
|
||||
var label = new labelModule.Label();
|
||||
var observer = label.on("loaded, tap, longPress", function (args: gestures.GestureEventData) {
|
||||
var label = new Label();
|
||||
var observer = label.on("loaded, tap, longPress", function (args: GestureEventData) {
|
||||
console.log("Event: " + args.eventName);
|
||||
});
|
||||
// << gestures-events-string
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
import * as TKUnit from "../../tk-unit";
|
||||
import { Page, View } from "@nativescript/core";
|
||||
import { Frame, NavigationEntry, _stack } from "@nativescript/core/ui/frame";
|
||||
import { _resetRootView, getRootView } from "@nativescript/core/application";
|
||||
import { TabView } from "@nativescript/core/ui/tab-view";
|
||||
import { GridLayout } from "@nativescript/core/ui/layouts/grid-layout";
|
||||
import { Page, TabView, View, GridLayout, Frame, NavigationEntry, Application } from "@nativescript/core";
|
||||
import * as helper from "../../ui-helper";
|
||||
|
||||
function createTestFrameRootEntry() {
|
||||
@@ -12,7 +8,7 @@ function createTestFrameRootEntry() {
|
||||
frameRoot.navigate(() => page);
|
||||
|
||||
const entry: NavigationEntry = {
|
||||
create: () => frameRoot
|
||||
create: () => <any>frameRoot
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -27,9 +23,9 @@ export function test_custom_component_rootview_css_applied() {
|
||||
moduleName: "ui/root-view/root-modules/custom-component-root"
|
||||
};
|
||||
|
||||
_resetRootView(entry);
|
||||
Application.resetRootView(entry);
|
||||
|
||||
var rootView = getRootView();
|
||||
var rootView = Application.getRootView();
|
||||
TKUnit.waitUntilReady(() => rootView.isLoaded);
|
||||
|
||||
TKUnit.assertNotNull(rootView);
|
||||
@@ -46,9 +42,9 @@ export function test_tabview_rootview_css_applied() {
|
||||
moduleName: "ui/root-view/root-modules/tabview-root"
|
||||
};
|
||||
|
||||
_resetRootView(entry);
|
||||
Application.resetRootView(entry);
|
||||
|
||||
var rootView = getRootView();
|
||||
var rootView = Application.getRootView();
|
||||
TKUnit.waitUntilReady(() => rootView.isLoaded);
|
||||
|
||||
TKUnit.assert(rootView instanceof TabView);
|
||||
@@ -60,9 +56,9 @@ export function test_gridlayout_rootview_css_applied() {
|
||||
moduleName: "ui/root-view/root-modules/gridlayout-root"
|
||||
};
|
||||
|
||||
_resetRootView(entry);
|
||||
Application.resetRootView(entry);
|
||||
|
||||
var rootView = getRootView();
|
||||
var rootView = Application.getRootView();
|
||||
TKUnit.waitUntilReady(() => rootView.isLoaded);
|
||||
|
||||
TKUnit.assert(rootView instanceof GridLayout);
|
||||
@@ -80,9 +76,9 @@ export function test_tabview_rootview_layout_updates() {
|
||||
function layout_invalidate_test(moduleName: string) {
|
||||
var entry = { moduleName };
|
||||
|
||||
_resetRootView(entry);
|
||||
Application.resetRootView(entry);
|
||||
|
||||
var rootView = getRootView();
|
||||
var rootView = Application.getRootView();
|
||||
TKUnit.waitUntilReady(() => rootView.isLayoutValid);
|
||||
|
||||
const lbl = <View>rootView.getViewById("my-test-label");
|
||||
@@ -101,6 +97,6 @@ export function tearDownModule() {
|
||||
// reset the root to frame for other tests
|
||||
const resetFrameRoot = createTestFrameRootEntry();
|
||||
|
||||
_resetRootView(resetFrameRoot.entry);
|
||||
Application.resetRootView(resetFrameRoot.entry);
|
||||
TKUnit.waitUntilReady(() => resetFrameRoot.page.isLoaded);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import * as TKUnit from "../../tk-unit";
|
||||
import { _resetRootView } from "@nativescript/core/application/";
|
||||
import { Frame, NavigationEntry, } from "@nativescript/core/ui/frame";
|
||||
import { Page } from "@nativescript/core/ui/page";
|
||||
import { Tabs, TabContentItem, TabStrip, TabStripItem } from "@nativescript/core/ui/tabs";
|
||||
import { Page, Frame, Tabs, TabContentItem, TabStrip, TabStripItem, NavigationEntry, Application } from "@nativescript/core";
|
||||
|
||||
function waitUntilNavigatedToMaxTimeout(pages: Page[], action: Function) {
|
||||
const maxTimeout = 8;
|
||||
@@ -84,7 +81,7 @@ export function test_frame_topmost_matches_selectedIndex() {
|
||||
create: () => tabView
|
||||
};
|
||||
|
||||
waitUntilNavigatedToMaxTimeout([items[0].page], () => _resetRootView(entry));
|
||||
waitUntilNavigatedToMaxTimeout([items[0].page], () => Application.resetRootView(entry));
|
||||
TKUnit.assertEqual(Frame.topmost().id, "Tab0 Frame0");
|
||||
|
||||
waitUntilNavigatedToMaxTimeout([items[1].page], () => tabView.selectedIndex = 1);
|
||||
@@ -131,7 +128,7 @@ export function test_frame_topmost_matches_selectedIndex() {
|
||||
// create: () => tabView
|
||||
// };
|
||||
|
||||
// waitUntilNavigatedToMaxTimeout([items[0].page], () => _resetRootView(entry));
|
||||
// waitUntilNavigatedToMaxTimeout([items[0].page], () => Application.resetRootView(entry));
|
||||
|
||||
// const expectedEventsRaisedAfterTabCreated = [
|
||||
// [
|
||||
@@ -193,5 +190,5 @@ export function tearDownModule() {
|
||||
create: () => frame
|
||||
};
|
||||
|
||||
waitUntilNavigatedToMaxTimeout([page], () => _resetRootView(entry));
|
||||
waitUntilNavigatedToMaxTimeout([page], () => Application.resetRootView(entry));
|
||||
}
|
||||
|
||||
@@ -1,19 +1,7 @@
|
||||
import * as TKUnit from "../../tk-unit";
|
||||
import { View, eachDescendant, getViewById, InheritedProperty, CssProperty, CssAnimationProperty, ShorthandProperty, Property, Style } from "@nativescript/core";
|
||||
import { Frame } from "@nativescript/core/ui/frame";
|
||||
import { Page } from "@nativescript/core/ui/page";
|
||||
import { Button } from "@nativescript/core/ui/button";
|
||||
import { Label } from "@nativescript/core/ui/label";
|
||||
import { Color } from "@nativescript/core/color";
|
||||
import { StackLayout } from "@nativescript/core/ui/layouts/stack-layout";
|
||||
import { AbsoluteLayout } from "@nativescript/core/ui/layouts/absolute-layout";
|
||||
import * as types from "@nativescript/core/utils/types";
|
||||
import { View, eachDescendant, getViewById, InheritedProperty, CssProperty, CssAnimationProperty, ShorthandProperty, Property, Style, Frame, Page, Button, Label, Color, StackLayout, AbsoluteLayout, Observable, Utils, BindingOptions, isAndroid, LayoutBase } from "@nativescript/core";
|
||||
import * as helper from "../../ui-helper";
|
||||
import * as observable from "@nativescript/core/data/observable";
|
||||
import * as bindable from "@nativescript/core/ui/core/bindable";
|
||||
import * as definition from "./view-tests";
|
||||
import { isAndroid } from "@nativescript/core/platform";
|
||||
import { LayoutBase } from "@nativescript/core/ui/layouts/layout-base";
|
||||
|
||||
export function test_eachDescendant() {
|
||||
const test = function (views: Array<View>) {
|
||||
@@ -27,7 +15,7 @@ export function test_eachDescendant() {
|
||||
return true;
|
||||
};
|
||||
|
||||
eachDescendant(Frame.topmost(), callback);
|
||||
eachDescendant(<any>Frame.topmost(), callback);
|
||||
// Descendants: page, actionBar, button
|
||||
TKUnit.assertEqual(counter, 3, "descendants");
|
||||
};
|
||||
@@ -40,7 +28,7 @@ export function test_getViewById_Static() {
|
||||
views[1].id = "myLayout";
|
||||
|
||||
// traverse the visual tree and verify the hierarchy
|
||||
const result = getViewById(Frame.topmost(), "myLayout");
|
||||
const result = getViewById(<any>Frame.topmost(), "myLayout");
|
||||
|
||||
TKUnit.assert(result === views[1]);
|
||||
};
|
||||
@@ -72,7 +60,7 @@ export function test_eachDescendant_Break_Iteration() {
|
||||
return false;
|
||||
};
|
||||
|
||||
eachDescendant(Frame.topmost(), callback);
|
||||
eachDescendant(<any>Frame.topmost(), callback);
|
||||
TKUnit.assert(counter === 1);
|
||||
};
|
||||
|
||||
@@ -82,11 +70,11 @@ export function test_eachDescendant_Break_Iteration() {
|
||||
export function test_parent_IsValid_WhenAttached_ToVisualTree() {
|
||||
const test = function (views: Array<View>) {
|
||||
// views[0] is a Page instance, its parent should be the topmost frame
|
||||
TKUnit.assert(types.isDefined(views[0].parent));
|
||||
TKUnit.assert(views[0].parent === Frame.topmost());
|
||||
TKUnit.assert(Utils.isDefined(views[0].parent));
|
||||
TKUnit.assert(views[0].parent === <any>Frame.topmost());
|
||||
|
||||
// views[1] is a Button instance, its parent should be the Page (views[0])
|
||||
TKUnit.assert(types.isDefined(views[1].parent));
|
||||
TKUnit.assert(Utils.isDefined(views[1].parent));
|
||||
TKUnit.assert(views[1].parent === views[0]);
|
||||
};
|
||||
|
||||
@@ -102,8 +90,8 @@ export function test_parent_IsReset_WhenDetached_FromVisualTree() {
|
||||
|
||||
helper.do_PageTest_WithStackLayout_AndButton(test);
|
||||
|
||||
TKUnit.assert(types.isUndefined(cachedViews[1].parent));
|
||||
TKUnit.assert(types.isDefined(cachedViews[2].parent));
|
||||
TKUnit.assert(Utils.isUndefined(cachedViews[1].parent));
|
||||
TKUnit.assert(Utils.isDefined(cachedViews[2].parent));
|
||||
TKUnit.assert(cachedViews[2].parent === cachedViews[1]);
|
||||
}
|
||||
|
||||
@@ -165,7 +153,7 @@ export function test_bindingContext_IsInherited() {
|
||||
};
|
||||
|
||||
helper.do_PageTest_WithStackLayout_AndButton(test);
|
||||
Frame.topmost().bindingContext = undefined;
|
||||
(<any>Frame.topmost()).bindingContext = undefined;
|
||||
}
|
||||
|
||||
export function test_isAddedToNativeVisualTree_IsUpdated() {
|
||||
@@ -705,10 +693,10 @@ export function test_InheritableProperties_ChangeNotification() {
|
||||
|
||||
function property_binding_test(propName: string, firstValue: any, secondValue: any, view?: View) {
|
||||
let actualResult;
|
||||
const model = new observable.Observable();
|
||||
const model = new Observable();
|
||||
model.set(propName, firstValue);
|
||||
|
||||
const options: bindable.BindingOptions = {
|
||||
const options: BindingOptions = {
|
||||
sourceProperty: propName,
|
||||
targetProperty: propName
|
||||
};
|
||||
@@ -729,10 +717,10 @@ function property_binding_test(propName: string, firstValue: any, secondValue: a
|
||||
|
||||
function property_binding_style_test(propName: string, firstValue: any, secondValue: any, view?: View) {
|
||||
let actualResult;
|
||||
const model = new observable.Observable();
|
||||
const model = new Observable();
|
||||
model.set(propName, firstValue);
|
||||
|
||||
const options: bindable.BindingOptions = {
|
||||
const options: BindingOptions = {
|
||||
sourceProperty: propName,
|
||||
targetProperty: "style." + propName
|
||||
};
|
||||
|
||||
@@ -46,9 +46,6 @@
|
||||
<TimePicker hour="10" minute="34" />
|
||||
<Image id="cameraImage" />
|
||||
<Button tap="setPicture" text="Get picture and set is to the image" />
|
||||
<Border cornerRadius="10" borderWidth="1" borderColor="#FF0000">
|
||||
<Button text="{{ text }}" tap="{{ myFunction }}" />
|
||||
</Border>
|
||||
<Label id="Label1" text="This is Label!" />
|
||||
<StackLayout orientation="horizontal">
|
||||
<Label text="From expression {{ id + 1 }}: " />
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { Property } from "@nativescript/core/ui/core/properties";
|
||||
import { LayoutBase } from "@nativescript/core/ui/layouts/layout-base";
|
||||
import { Builder } from "@nativescript/core/ui/builder";
|
||||
import { Property, LayoutBase, Builder } from "@nativescript/core";
|
||||
|
||||
export module knownTemplates {
|
||||
export var template = "template";
|
||||
|
||||
@@ -1,21 +1,14 @@
|
||||
import * as TKUnit from "../tk-unit";
|
||||
import { Builder, Button, Switch, SearchBar, TextField, GridLayout, AbsoluteLayout, Observable, TabView, Page, Label } from "@nativescript/core";
|
||||
import * as types from "@nativescript/core/utils/types";
|
||||
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 listViewModule from "@nativescript/core/ui/list-view";
|
||||
import * as helper from "../ui-helper";
|
||||
import * as platform from "@nativescript/core/platform";
|
||||
import * as gesturesModule from "@nativescript/core/ui/gestures";
|
||||
import * as segmentedBar from "@nativescript/core/ui/segmented-bar";
|
||||
import { Source } from "@nativescript/core/utils/debug";
|
||||
import { View, getAncestor, eachDescendant, PercentLength, Length } from "@nativescript/core";
|
||||
|
||||
export function test_load_IsDefined() {
|
||||
TKUnit.assertTrue(types.isFunction(Builder.load), "Builder should have load method!");
|
||||
TKUnit.assertTrue(Utils.isFunction(Builder.load), "Builder should have load method!");
|
||||
}
|
||||
|
||||
export function test_parse_IsDefined() {
|
||||
TKUnit.assertTrue(types.isFunction(Builder.parse), "Builder should have parse method!");
|
||||
TKUnit.assertTrue(Utils.isFunction(Builder.parse), "Builder should have parse method!");
|
||||
}
|
||||
|
||||
export function test_load_ShouldThrowWithInvalidFileName() {
|
||||
@@ -190,7 +183,7 @@ export function test_parse_ShouldResolveExportsFromCodeFileForTemplates() {
|
||||
|
||||
var obj = new Observable();
|
||||
obj.set("items", [1]);
|
||||
obj.set("itemLoading", function (args: listViewModule.ItemEventData) {
|
||||
obj.set("itemLoading", function (args: ItemEventData) {
|
||||
ctrl = args.view;
|
||||
});
|
||||
p.bindingContext = obj;
|
||||
@@ -328,7 +321,7 @@ export function test_parse_ShouldParsePlatformSpecificProperties() {
|
||||
var p = <Page>Builder.parse("<Page><TextField ios:editable='False' android:editable='True' /></Page>");
|
||||
var tf = <TextField>p.content;
|
||||
|
||||
if (platform.Device.os === platform.platformNames.ios) {
|
||||
if (Device.os === platformNames.ios) {
|
||||
TKUnit.assertFalse(tf.editable, "Expected result: false; Actual result: " + tf.editable + "; type: " + typeof (tf.editable));
|
||||
} else {
|
||||
TKUnit.assertTrue(tf.editable, "Expected result: true; Actual result: " + tf.editable + "; type: " + typeof (tf.editable));
|
||||
@@ -337,7 +330,7 @@ export function test_parse_ShouldParsePlatformSpecificProperties() {
|
||||
|
||||
export function test_parse_ShouldParsePlatformSpecificComponents() {
|
||||
var p = <Page>Builder.parse("<Page><ios><TextField /></ios><android><Label /></android></Page>");
|
||||
if (platform.Device.os === platform.platformNames.ios) {
|
||||
if (Device.os === platformNames.ios) {
|
||||
TKUnit.assert(p.content instanceof TextField, "Expected result: TextField; Actual result: " + p.content);
|
||||
}
|
||||
else {
|
||||
@@ -413,7 +406,7 @@ export function test_parse_ShouldParseBindingsToGestures() {
|
||||
p.bindingContext = context;
|
||||
var lbl = <Label>p.content;
|
||||
|
||||
var observer = (<View>lbl).getGestureObservers(gesturesModule.GestureTypes.tap)[0];
|
||||
var observer = (<View>lbl).getGestureObservers(GestureTypes.tap)[0];
|
||||
|
||||
TKUnit.assert(observer !== undefined, "Expected result: true.");
|
||||
TKUnit.assert(observer.context === context, "Context should be equal to binding context. Actual result: " + observer.context);
|
||||
@@ -430,7 +423,7 @@ export function test_parse_ShouldParseBindingsToGesturesWithOn() {
|
||||
p.bindingContext = context;
|
||||
var lbl = <Label>p.content;
|
||||
|
||||
var observer = (<View>lbl).getGestureObservers(gesturesModule.GestureTypes.tap)[0];
|
||||
var observer = (<View>lbl).getGestureObservers(GestureTypes.tap)[0];
|
||||
|
||||
TKUnit.assert(observer !== undefined, "Expected result: true.");
|
||||
TKUnit.assert(observer.context === context, "Context should be equal to binding context. Actual result: " + observer.context);
|
||||
@@ -498,7 +491,7 @@ export function test_parse_ShouldParseLowerCaseDashedComponentDeclaration() {
|
||||
|
||||
TKUnit.assert(ctrl instanceof StackLayout, "Expected result: StackLayout!; Actual result: " + ctrl);
|
||||
TKUnit.assert(ctrl.getChildAt(0) instanceof Label, "Expected result: Label!; Actual result: " + ctrl.getChildAt(0));
|
||||
TKUnit.assert(ctrl.getChildAt(1) instanceof segmentedBar.SegmentedBar, "Expected result: Label!; Actual result: " + ctrl.getChildAt(0));
|
||||
TKUnit.assert(ctrl.getChildAt(1) instanceof SegmentedBar, "Expected result: Label!; Actual result: " + ctrl.getChildAt(0));
|
||||
}
|
||||
|
||||
export function test_parse_ShouldParseCustomComponentWithoutXml() {
|
||||
@@ -573,7 +566,7 @@ export function test_parse_ShouldParseCustomComponentWithoutXmlInListViewTemplat
|
||||
let ctrl;
|
||||
let obj = new Observable();
|
||||
obj.set("items", [1]);
|
||||
obj.set("itemLoading", function (args: listViewModule.ItemEventData) {
|
||||
obj.set("itemLoading", function (args: ItemEventData) {
|
||||
ctrl = args.view;
|
||||
});
|
||||
p.bindingContext = obj;
|
||||
@@ -593,12 +586,12 @@ export function test_parse_ShouldParseNestedListViewInListViewTemplate() {
|
||||
let ctrl;
|
||||
let obj = new Observable();
|
||||
obj.set("items", [{ subItems: [1] }]);
|
||||
obj.set("itemLoading", function (args: listViewModule.ItemEventData) {
|
||||
obj.set("itemLoading", function (args: ItemEventData) {
|
||||
ctrl = args.view;
|
||||
});
|
||||
p.bindingContext = obj;
|
||||
TKUnit.waitUntilReady(() => !!ctrl);
|
||||
TKUnit.assert(ctrl instanceof listViewModule.ListView, "Expected result: ListView!; Actual result: " + ctrl);
|
||||
TKUnit.assert(ctrl instanceof ListView, "Expected result: ListView!; Actual result: " + ctrl);
|
||||
}
|
||||
|
||||
helper.navigate(function () { return p; });
|
||||
@@ -609,22 +602,22 @@ export function test_parse_ShouldEvaluateEventBindingExpressionInListViewTemplat
|
||||
var p = <Page>Builder.parse("<Page xmlns=\"http://schemas.nativescript.org/tns.xsd\"><ListView items=\"{{ items }}\" itemLoading=\"{{ itemLoading }}\"><ListView.itemTemplate><SegmentedBar items=\"{{ $parents['ListView'].segmentedBarItems }}\" selectedIndexChanged=\"{{ $parents['ListView'].changed }}\" /></ListView.itemTemplate></ListView></Page>");
|
||||
|
||||
function testAction(views: Array<View>) {
|
||||
let ctrl: segmentedBar.SegmentedBar = null;
|
||||
let ctrl: SegmentedBar = null;
|
||||
let changed;
|
||||
let obj = new Observable();
|
||||
|
||||
let firstItem = new segmentedBar.SegmentedBarItem();
|
||||
let firstItem = new SegmentedBarItem();
|
||||
firstItem.title = "One";
|
||||
let secondItem = new segmentedBar.SegmentedBarItem();
|
||||
let secondItem = new SegmentedBarItem();
|
||||
secondItem.title = "Two";
|
||||
let thirdItem = new segmentedBar.SegmentedBarItem();
|
||||
let thirdItem = new SegmentedBarItem();
|
||||
thirdItem.title = "Tree";
|
||||
let segmentedBarItems = [firstItem, secondItem, thirdItem];
|
||||
|
||||
obj.set("items", [1, 2, 3]);
|
||||
obj.set("segmentedBarItems", segmentedBarItems);
|
||||
obj.set("itemLoading", function (args: listViewModule.ItemEventData) {
|
||||
ctrl = <segmentedBar.SegmentedBar>args.view;
|
||||
obj.set("itemLoading", function (args: ItemEventData) {
|
||||
ctrl = <SegmentedBar>args.view;
|
||||
});
|
||||
|
||||
obj.set("changed", function (args: EventData) {
|
||||
@@ -904,10 +897,10 @@ export function test_hasSourceCodeLocations() {
|
||||
var basePath = "xml-declaration/";
|
||||
var page = <Page>Builder.load(basePath + "examples/test-page.xml");
|
||||
var grid = page.getViewById("grid");
|
||||
var gridSource = Source.get(grid);
|
||||
var gridSource = Utils.Source.get(grid);
|
||||
TKUnit.assertEqual(gridSource.toString(), basePath + "examples/test-page.xml:2:3");
|
||||
var label = page.getViewById("label");
|
||||
var labelSource = Source.get(label);
|
||||
var labelSource = Utils.Source.get(label);
|
||||
TKUnit.assertEqual(labelSource.toString(), basePath + "examples/test-page.xml:3:5");
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
"clean": "npx rimraf hooks node_modules platforms package-lock.json && npm i"
|
||||
},
|
||||
"dependencies": {
|
||||
"@nativescript/core": "file:../dist/nativescript-core-7.0.0-rc.6.tgz"
|
||||
"@nativescript/core": "file:../dist/nativescript-core-7.0.0-rc.9.tgz"
|
||||
},
|
||||
"devDependencies": {
|
||||
"circular-dependency-plugin": "~5.2.0",
|
||||
"@nativescript/webpack": "^2.0.0-alpha.3",
|
||||
"node-sass": "^4.14.0",
|
||||
"@nativescript/types": "file:../dist/nativescript-types-7.0.0-rc.0.tgz",
|
||||
"@nativescript/types": "~7.0.0-rc.0",
|
||||
"typescript": "~3.9.0"
|
||||
},
|
||||
"gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3",
|
||||
|
||||
1
tests/reference.d.ts
vendored
1
tests/reference.d.ts
vendored
@@ -1,3 +1,2 @@
|
||||
/// <reference path="./node_modules/@nativescript/core/module.d.ts" />
|
||||
/// <reference path="./node_modules/@nativescript/types/android.d.ts" />
|
||||
/// <reference path="./node_modules/@nativescript/types/ios.d.ts" />
|
||||
|
||||
Reference in New Issue
Block a user