diff --git a/.gitignore b/.gitignore index 24b08c83e4..483637624e 100644 --- a/.gitignore +++ b/.gitignore @@ -59,4 +59,6 @@ ios-typings-prj .nx/cache .nx/workspace-data vite.config.*.timestamp* -vitest.config.*.timestamp* \ No newline at end of file +vitest.config.*.timestamp* +.cursor/rules/nx-rules.mdc +.github/instructions/nx.instructions.md diff --git a/apps/automated/.gitignore b/apps/automated/.gitignore index 512c68e15a..e9dc6c6f24 100644 --- a/apps/automated/.gitignore +++ b/apps/automated/.gitignore @@ -1 +1,2 @@ !webpack.config.js +hooks \ No newline at end of file diff --git a/apps/automated/package.json b/apps/automated/package.json index 6b5d728d9d..e02cd5ac00 100644 --- a/apps/automated/package.json +++ b/apps/automated/package.json @@ -11,12 +11,12 @@ "nativescript-theme-core": "file:../../node_modules/nativescript-theme-core" }, "devDependencies": { - "@nativescript/android": "~8.8.0", - "@nativescript/ios": "~8.8.0", - "@nativescript/visionos": "~8.8.0", + "@nativescript/android": "~8.9.0", + "@nativescript/ios": "~8.9.0", + "@nativescript/visionos": "~8.9.0", "@nativescript/webpack": "file:../../dist/packages/webpack5", "circular-dependency-plugin": "^5.2.2", - "typescript": "~5.6.0" + "typescript": "~5.8.0" }, "gitHead": "c06800e52ee1a184ea2dffd12a6702aaa43be4e3", "readme": "NativeScript Application" diff --git a/apps/automated/src/debugger/dom-node-tests.ts b/apps/automated/src/debugger/dom-node-tests.ts index 52b8b8ad88..80d76e21c4 100644 --- a/apps/automated/src/debugger/dom-node-tests.ts +++ b/apps/automated/src/debugger/dom-node-tests.ts @@ -1,15 +1,9 @@ import { assert, assertEqual } from '../tk-unit'; -import { DOMNode } from '@nativescript/core/debugger/dom-node'; +import { DOMNode } from '@nativescript/core/debugger/dom-types'; import { attachDOMInspectorCommandCallbacks, attachCSSInspectorCommandCallbacks, attachDOMInspectorEventCallbacks } from '@nativescript/core/debugger/devtools-elements'; import { InspectorCommands, InspectorEvents } from '@nativescript/core/debugger/devtools-elements'; -import { unsetValue } from '@nativescript/core/ui/core/properties'; -import { Button } from '@nativescript/core/ui/button'; -import { Slider } from '@nativescript/core/ui/slider'; -import { Label } from '@nativescript/core/ui/label'; +import { unsetValue, Button, Slider, Label, TextView, StackLayout, isAndroid } from '@nativescript/core'; import { textProperty } from '@nativescript/core/ui/text-base'; -import { TextView } from '@nativescript/core/ui/text-view'; -import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout'; -import { isAndroid } from '@nativescript/core/platform'; let originalInspectorGlobal: InspectorCommands & InspectorEvents; diff --git a/apps/automated/src/file-system/file-system-tests.ts b/apps/automated/src/file-system/file-system-tests.ts index 559d3126cc..e502418a56 100644 --- a/apps/automated/src/file-system/file-system-tests.ts +++ b/apps/automated/src/file-system/file-system-tests.ts @@ -746,7 +746,7 @@ export function testAndroidCreate() { export function test_FileAppend(done) { const content = 'Hello World'; - const hello_world = global.isIOS ? NSString.stringWithString(content).dataUsingEncoding(NSUTF8StringEncoding) : new java.lang.String(content).getBytes('UTF-8'); + const hello_world = __APPLE__ ? NSString.stringWithString(content).dataUsingEncoding(NSUTF8StringEncoding) : new java.lang.String(content).getBytes('UTF-8'); const file = fs.File.fromPath(fs.path.join(fs.knownFolders.temp().path, `${Date.now()}-app.txt`)); file .appendText('Hello') diff --git a/apps/automated/src/pages/property-bindings.ts b/apps/automated/src/pages/property-bindings.ts index 12a9ec9fcd..cb7c3f8bca 100644 --- a/apps/automated/src/pages/property-bindings.ts +++ b/apps/automated/src/pages/property-bindings.ts @@ -8,7 +8,7 @@ import { Trace } from '@nativescript/core'; import * as gridModule from '@nativescript/core/ui/layouts/grid-layout'; import * as sliders from '@nativescript/core/ui/slider'; import * as switches from '@nativescript/core/ui/switch'; -import * as bindable from '@nativescript/core/ui/core/bindable'; +import type { BindingOptions } from '@nativescript/core/ui/core/bindable/bindable-types'; Trace.enable(); //Trace.setCategories(Trace.categories.Style + " ," + Trace.categories.Binding); @@ -64,7 +64,7 @@ export function createPage() { slider.value = desc.value; stack.addChild(slider); - var options: bindable.BindingOptions = { + var options: BindingOptions = { sourceProperty: 'value', targetProperty: desc.name, }; @@ -82,7 +82,7 @@ export function createPage() { sw.horizontalAlignment = 'left'; stack.addChild(sw); - var options: bindable.BindingOptions = { + var options: BindingOptions = { sourceProperty: 'checked', targetProperty: desc.name, }; @@ -99,7 +99,7 @@ export function createPage() { txt.text = desc.value; stack.addChild(txt); - var options: bindable.BindingOptions = { + var options: BindingOptions = { sourceProperty: 'text', targetProperty: desc.name, }; diff --git a/apps/automated/src/test-runner.ts b/apps/automated/src/test-runner.ts index 33a4c6858e..bd507b7170 100644 --- a/apps/automated/src/test-runner.ts +++ b/apps/automated/src/test-runner.ts @@ -2,7 +2,7 @@ import * as TKUnit from './tk-unit'; import './ui-test'; -import { isIOS, isAndroid, Application, Device, platformNames, Trace, Button, Frame, StackLayout, Page, TextView, Utils, Color } from '@nativescript/core'; +import { isAndroid, Device, platformNames, Trace, Button, Frame, StackLayout, Page, TextView, Utils, Color } from '@nativescript/core'; Frame.defaultAnimatedNavigation = false; export function isRunningOnEmulator(): boolean { @@ -147,7 +147,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 (isIOS && Utils.ios.MajorVersion > 10) { +if (__APPLE__ && Utils.SDK_VERSION > 10) { allTests['SAFEAREALAYOUT'] = safeAreaLayoutTests; allTests['SAFEAREA-LISTVIEW'] = safeAreaListViewtTests; allTests['SAFEAREA-SCROLL-VIEW'] = scrollViewSafeAreaTests; diff --git a/apps/automated/src/tk-unit.ts b/apps/automated/src/tk-unit.ts index c875f60f4c..3c79c6dffc 100644 --- a/apps/automated/src/tk-unit.ts +++ b/apps/automated/src/tk-unit.ts @@ -11,8 +11,7 @@ */ -import { isIOS, Trace, Device } from '@nativescript/core'; -import * as types from '@nativescript/core/utils/types'; +import { Trace, Device, Utils } from '@nativescript/core'; const sdkVersion = parseInt(Device.sdkVersion); @@ -172,10 +171,10 @@ export function assertFalse(test: boolean, message?: string) { export function assertNotEqual(actual: any, expected: any, message?: string) { let equals = false; - if (types.isUndefined(actual) && types.isUndefined(expected)) { + if (Utils.isUndefined(actual) && Utils.isUndefined(expected)) { equals = true; - } else if (!types.isNullOrUndefined(actual) && !types.isNullOrUndefined(expected)) { - if (types.isFunction(actual.equals)) { + } else if (!Utils.isNullOrUndefined(actual) && !Utils.isNullOrUndefined(expected)) { + if (Utils.isFunction(actual.equals)) { // Use the equals method if (actual.equals(expected)) { equals = true; @@ -191,7 +190,7 @@ export function assertNotEqual(actual: any, expected: any, message?: string) { } export function assertEqual(actual: T, expected: T, message: string = '') { - if (!types.isNullOrUndefined(actual) && !types.isNullOrUndefined(expected) && types.getClass(actual) === types.getClass(expected) && types.isFunction((actual).equals)) { + if (!Utils.isNullOrUndefined(actual) && !Utils.isNullOrUndefined(expected) && Utils.getClass(actual) === Utils.getClass(expected) && Utils.isFunction((actual).equals)) { // Use the equals method if (!(actual).equals(expected)) { throw new Error(`${message} Actual: <${actual}>(${typeof actual}). Expected: <${expected}>(${typeof expected})`); @@ -352,7 +351,7 @@ export function waitUntilReady(isReady: () => boolean, timeoutSec: number = 5, s return; } - if (isIOS) { + if (__APPLE__) { const timeoutMs = timeoutSec * 1000; let totalWaitTime = 0; while (true) { diff --git a/apps/automated/src/ui-helper.ts b/apps/automated/src/ui-helper.ts index 487ba37cf0..3e1879dbec 100644 --- a/apps/automated/src/ui-helper.ts +++ b/apps/automated/src/ui-helper.ts @@ -1,4 +1,4 @@ -import { Color, Button, FormattedString, Span, ActionBar, Builder, isIOS, unsetValue, View, ViewBase, Frame, NavigationEntry, LayoutBase, StackLayout, Page, TabView, TabViewItem, Utils } from '@nativescript/core'; +import { Color, Button, FormattedString, Span, ActionBar, Builder, unsetValue, View, ViewBase, Frame, NavigationEntry, LayoutBase, StackLayout, Page, TabView, TabViewItem, Utils } from '@nativescript/core'; import * as TKUnit from './tk-unit'; @@ -255,7 +255,7 @@ export function assertTabSelectedTabTextColor(testView: ViewBase, hexColor: stri } export function forceGC() { - if (isIOS) { + if (__APPLE__) { /* tslint:disable:no-unused-expression */ // Could cause GC on the next call. new ArrayBuffer(4 * 1024 * 1024); @@ -295,7 +295,7 @@ export function _generateFormattedString(): FormattedString { export function nativeView_recycling_test(createNew: () => View, createLayout?: () => LayoutBase, nativeGetters?: Map any>, customSetters?: Map) { return; - // if (isIOS) { + // if (__APPLE__) { // // recycling not implemented yet. // return; // } diff --git a/apps/automated/src/ui/action-bar/action-bar-tests-common.ts b/apps/automated/src/ui/action-bar/action-bar-tests-common.ts index b0abe4c7ed..708414ff1f 100644 --- a/apps/automated/src/ui/action-bar/action-bar-tests-common.ts +++ b/apps/automated/src/ui/action-bar/action-bar-tests-common.ts @@ -1,16 +1,6 @@ import * as TKUnit from '../../tk-unit'; import * as helper from '../../ui-helper'; -import { Builder } from '@nativescript/core/ui/builder'; -import { Label } from '@nativescript/core/ui/label'; -import { Button } from '@nativescript/core/ui/button'; -import { Page } from '@nativescript/core/ui/page'; -import { View, isIOS } from '@nativescript/core'; -import { fromObject } from '@nativescript/core/data/observable'; -import { Frame } from '@nativescript/core/ui/frame'; - -// >> actionbar-common-require -import * as actionBarModule from '@nativescript/core/ui/action-bar'; -// << actionbar-common-require +import { View, fromObject, Frame, Page, Button, Label, Builder, ActionItem, ActionBar } from '@nativescript/core'; export function test_actionItem_inherit_bindingContext() { let page: Page; @@ -20,7 +10,7 @@ export function test_actionItem_inherit_bindingContext() { const pageFactory = function (): Page { page = new Page(); page.bindingContext = context; - const actionItem = new actionBarModule.ActionItem(); + const actionItem = new ActionItem(); actionItem.bind({ sourceProperty: 'text', @@ -164,7 +154,7 @@ export function test_Setting_ActionItems_doesnt_thrown() { const pageFactory = function (): Page { page = new Page(); - const actionItem = new actionBarModule.ActionItem(); + const actionItem = new ActionItem(); actionItem.text = 'Item'; page.actionBar.actionItems.addItem(actionItem); @@ -286,12 +276,12 @@ export function test_ActionBarVisibility_Never_ShouldNotShowDeclaredActionBar() - ` + `, ); helper.navigate(() => page); let actionBarHidden = false; - if (isIOS) { + if (__APPLE__) { actionBarHidden = page.actionBar.nativeView.hidden; } else { actionBarHidden = !page.actionBar.nativeView.isShown(); @@ -314,12 +304,12 @@ export function test_ActionBarVisibility_Always_ShouldShownHiddenActionBar() { - ` + `, ); helper.navigate(() => page); let actionBarHidden = false; - if (isIOS) { + if (__APPLE__) { actionBarHidden = page.actionBar.nativeView.hidden; } else { actionBarHidden = !page.actionBar.nativeView.isShown(); @@ -342,12 +332,12 @@ export function test_ActionBarVisibility_Auto_ShouldRespectPageActionBarHiddenPr - ` + `, ); helper.navigate(() => page); let actionBarHidden = false; - if (isIOS) { + if (__APPLE__) { actionBarHidden = page.actionBar.nativeView.hidden; } else { actionBarHidden = !page.actionBar.nativeView.isShown(); @@ -391,5 +381,5 @@ export function createPageAndNavigate() { } export function test_recycling() { - helper.nativeView_recycling_test(() => new actionBarModule.ActionBar()); + helper.nativeView_recycling_test(() => new ActionBar()); } diff --git a/apps/automated/src/ui/animation/animation-tests.ts b/apps/automated/src/ui/animation/animation-tests.ts index 7a96d2a7a5..c9794d9029 100644 --- a/apps/automated/src/ui/animation/animation-tests.ts +++ b/apps/automated/src/ui/animation/animation-tests.ts @@ -1,11 +1,6 @@ import * as TKUnit from '../../tk-unit'; import * as helper from '../../ui-helper'; -import * as viewModule from '@nativescript/core/ui/core/view'; -import { Label } from '@nativescript/core/ui/label'; -import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout'; -import * as colorModule from '@nativescript/core/color'; -import { CoreTypes, PercentLength } from '@nativescript/core'; -import { AnimationPromise, AnimationDefinition, Animation } from '@nativescript/core/ui/animation'; +import { AnimationPromise, AnimationDefinition, Animation, CoreTypes, PercentLength, Label, StackLayout, View, Color } from '@nativescript/core'; // >> animation-require // import * as animation from '@nativescript/core/ui/animation'; @@ -38,7 +33,7 @@ export function test_AnimatingProperties(done) { label .animate({ opacity: 0.75, - backgroundColor: new colorModule.Color('Red'), + backgroundColor: new Color('Red'), translate: { x: 100, y: 100 }, scale: { x: 2, y: 2 }, rotate: 180, @@ -269,7 +264,7 @@ export function test_AnimateOpacity(done) { export function test_AnimateOpacity_ShouldThrow_IfNotNumber() { var label = new Label(); - helper.buildUIAndRunTest(label, (views: Array) => { + helper.buildUIAndRunTest(label, (views: Array) => { TKUnit.assertThrows(() => { label.animate({ opacity: '0.75' }); }, 'Setting opacity to a non number should throw.'); @@ -278,7 +273,7 @@ export function test_AnimateOpacity_ShouldThrow_IfNotNumber() { export function test_AnimateDelay_ShouldThrow_IfNotNumber() { var label = new Label(); - helper.buildUIAndRunTest(label, (views: Array) => { + helper.buildUIAndRunTest(label, (views: Array) => { TKUnit.assertThrows(() => { label.animate({ delay: '1' }); }, 'Setting delay to a non number should throw.'); @@ -287,7 +282,7 @@ export function test_AnimateDelay_ShouldThrow_IfNotNumber() { export function test_AnimateDuration_ShouldThrow_IfNotNumber() { var label = new Label(); - helper.buildUIAndRunTest(label, (views: Array) => { + helper.buildUIAndRunTest(label, (views: Array) => { TKUnit.assertThrows(() => { label.animate({ duration: '1' }); }, 'Setting duration to a non number should throw.'); @@ -296,7 +291,7 @@ export function test_AnimateDuration_ShouldThrow_IfNotNumber() { export function test_AnimateIterations_ShouldThrow_IfNotNumber() { var label = new Label(); - helper.buildUIAndRunTest(label, (views: Array) => { + helper.buildUIAndRunTest(label, (views: Array) => { TKUnit.assertThrows(() => { label.animate({ iterations: '1' }); }, 'Setting iterations to a non number should throw.'); @@ -305,7 +300,7 @@ export function test_AnimateIterations_ShouldThrow_IfNotNumber() { export function test_AnimateRotate_ShouldThrow_IfNotNumber() { var label = new Label(); - helper.buildUIAndRunTest(label, (views: Array) => { + helper.buildUIAndRunTest(label, (views: Array) => { TKUnit.assertThrows(() => { label.animate({ rotate: '1' }); }, 'Setting rotate to a non number should throw.'); @@ -314,7 +309,7 @@ export function test_AnimateRotate_ShouldThrow_IfNotNumber() { export function test_AnimateScale_ShouldThrow_IfNotPair() { var label = new Label(); - helper.buildUIAndRunTest(label, (views: Array) => { + helper.buildUIAndRunTest(label, (views: Array) => { TKUnit.assertThrows(() => { label.animate({ scale: '1' }); }, 'Setting scale to a non Pair should throw.'); @@ -323,7 +318,7 @@ export function test_AnimateScale_ShouldThrow_IfNotPair() { export function test_AnimateTranslate_ShouldThrow_IfNotPair() { var label = new Label(); - helper.buildUIAndRunTest(label, (views: Array) => { + helper.buildUIAndRunTest(label, (views: Array) => { TKUnit.assertThrows(() => { label.animate({ translate: '1' }); }, 'Setting translate to a non Pair should throw.'); @@ -332,7 +327,7 @@ export function test_AnimateTranslate_ShouldThrow_IfNotPair() { export function test_AnimateBackgroundColor_ShouldThrow_IfNotValidColorStringOrColor() { var label = new Label(); - helper.buildUIAndRunTest(label, (views: Array) => { + helper.buildUIAndRunTest(label, (views: Array) => { TKUnit.assertThrows(() => { label.animate({ backgroundColor: 'test' }); }, 'Setting backgroundColor to a not valid color string or Color should throw.'); @@ -341,12 +336,12 @@ export function test_AnimateBackgroundColor_ShouldThrow_IfNotValidColorStringOrC export function test_AnimateBackgroundColor(done) { let label = prepareTest(); - var red = new colorModule.Color('Red'); + var red = new Color('Red'); label .animate({ backgroundColor: red, duration: 5 }) .then(() => { - TKUnit.assert((label.backgroundColor).equals(red)); + TKUnit.assert((label.backgroundColor).equals(red)); done(); }) .catch((e) => { @@ -357,12 +352,12 @@ export function test_AnimateBackgroundColor(done) { export function test_AnimateBackgroundColor_FromString(done) { let label = prepareTest(); var expected = 'Red'; - var clr = new colorModule.Color(expected); + var clr = new Color(expected); label .animate({ backgroundColor: expected, duration: 5 }) .then(() => { - TKUnit.assert((label.backgroundColor).equals(clr)); + TKUnit.assert((label.backgroundColor).equals(clr)); done(); }) .catch((e) => { @@ -505,7 +500,7 @@ export function test_AnimateExtent_Should_AcceptNumberValuesAsDip(done) { export function test_AnimateExtent_Should_ThrowIfCannotParsePercentLength() { const label = new Label(); - helper.buildUIAndRunTest(label, (views: Array) => { + helper.buildUIAndRunTest(label, (views: Array) => { TKUnit.assertThrows(() => { label.animate({ width: '-frog%' }); }, 'Invalid percent string should throw'); @@ -633,8 +628,8 @@ export function test_PlayPromiseIsRejectedWhenAnimationIsCancelled(done) { animation.cancel(); } -function assertIOSNativeTransformIsCorrect(view: viewModule.View) { - if (global.isIOS) { +function assertIOSNativeTransformIsCorrect(view: View) { + if (__APPLE__) { var errorMessage = (require('@nativescript/core/ui/animation'))._getTransformMismatchErrorMessage(view); if (errorMessage) { TKUnit.assert(false, errorMessage); diff --git a/apps/automated/src/ui/button/button-tests.ts b/apps/automated/src/ui/button/button-tests.ts index 6161b4feaf..07f9a1b112 100644 --- a/apps/automated/src/ui/button/button-tests.ts +++ b/apps/automated/src/ui/button/button-tests.ts @@ -1,12 +1,7 @@ import * as TKUnit from '../../tk-unit'; import * as helper from '../../ui-helper'; -import { View, EventData, Button, Observable, Color, Page, FormattedString } from '@nativescript/core'; +import { View, EventData, Button, Observable, Color, Page, FormattedString, BindingOptions, Span } from '@nativescript/core'; import * as buttonTestsNative from './button-tests-native'; -import * as spanModule from '@nativescript/core/text/span'; - -// >> button-require-others -import { BindingOptions } from '@nativescript/core/ui/core/bindable'; -// << button-require-others export function test_recycling() { helper.nativeView_recycling_test(() => new Button()); @@ -326,13 +321,13 @@ export var testNativeTextAlignmentFromLocal = function () { }; export var test_WhenFormattedTextPropertyChanges_TextIsUpdated_Button = function () { - var firstSpan = new spanModule.Span(); + var firstSpan = new Span(); firstSpan.fontSize = 10; firstSpan.text = 'First'; - var secondSpan = new spanModule.Span(); + var secondSpan = new Span(); secondSpan.fontSize = 15; secondSpan.text = 'Second'; - var thirdSpan = new spanModule.Span(); + var thirdSpan = new Span(); thirdSpan.fontSize = 20; thirdSpan.text = 'Third'; var formattedString1 = new FormattedString(); @@ -392,7 +387,7 @@ export function test_setting_formattedText_With_UnknownFont_DoesNotCrash() { helper.buildUIAndRunTest(btn, function (views) { TKUnit.waitUntilReady(() => btn.isLayoutValid); - let span = new spanModule.Span(); + let span = new Span(); span.text = 'Login'; let formattedString = new FormattedString(); formattedString.spans.push(span); diff --git a/apps/automated/src/ui/core/bindable/bindable-tests.ts b/apps/automated/src/ui/core/bindable/bindable-tests.ts index 8007ee0ff3..825db61c91 100644 --- a/apps/automated/src/ui/core/bindable/bindable-tests.ts +++ b/apps/automated/src/ui/core/bindable/bindable-tests.ts @@ -1,11 +1,7 @@ -import { Observable, fromObject, fromObjectRecursive } from '@nativescript/core/data/observable'; -import { ViewBase } from '@nativescript/core/ui/core/view-base'; -import { BindingOptions } from '@nativescript/core/ui/core/bindable'; +import { Application, View, Button, Page, StackLayout, Label, TextField, Trace, BindingOptions, ViewBase, Observable, fromObject, fromObjectRecursive, Utils } from '@nativescript/core'; import * as TKUnit from '../../../tk-unit'; -import * as types from '@nativescript/core/utils/types'; import * as helper from '../../../ui-helper'; import * as bindingBuilder from '@nativescript/core/ui/builder/binding-builder'; -import { Application, View, Button, Page, StackLayout, Label, TextField, Trace } from '@nativescript/core'; declare var WeakRef: any; // // For information and examples how to use bindings please refer to special [**Data binding**](../../../../bindings.md) topic. @@ -17,8 +13,8 @@ declare var WeakRef: any; export function test_Bindable_Members() { const obj = new Label(); - TKUnit.assert(types.isDefined(obj.bind), 'Bindable.bind not defined'); - TKUnit.assert(types.isDefined(obj.unbind), 'Bindable.unbind not defined'); + TKUnit.assert(Utils.isDefined(obj.bind), 'Bindable.bind not defined'); + TKUnit.assert(Utils.isDefined(obj.unbind), 'Bindable.unbind not defined'); } export function test_Binding_to_bindingContext_of_View() { @@ -502,7 +498,7 @@ export function test_bindingToNestedPropertyWithValueSyntax() { sourceProperty: '$value.testProperty', targetProperty: 'targetPropertyName', }, - bindingSource + bindingSource, ); TKUnit.assertEqual(testElement.get('targetPropertyName'), 'testValue'); @@ -706,7 +702,7 @@ export function test_UpdatingNestedPropertyViaBinding() { targetProperty: 'text', twoWay: true, }, - viewModel + viewModel, ); const testElement2 = new Label(); @@ -717,7 +713,7 @@ export function test_UpdatingNestedPropertyViaBinding() { targetProperty: 'text', twoWay: true, }, - viewModel + viewModel, ); TKUnit.assertEqual(testElement.get('text'), expectedValue1); @@ -803,7 +799,7 @@ export function test_NestedPropertiesBinding() { targetProperty: 'targetProperty', twoWay: true, }, - viewModel + viewModel, ); TKUnit.assertEqual(target1.get('targetProperty'), expectedValue); @@ -835,7 +831,7 @@ export function test_WrongNestedPropertiesBinding() { targetProperty: 'targetProperty', twoWay: true, }, - viewModel + viewModel, ); TKUnit.assertNotEqual(errorMessage, undefined); @@ -856,7 +852,7 @@ export function test_NestedPropertiesBindingTwoTargets() { targetProperty: 'targetProperty', twoWay: true, }, - viewModel + viewModel, ); const target2 = new Label(); @@ -866,7 +862,7 @@ export function test_NestedPropertiesBindingTwoTargets() { targetProperty: 'targetProp', twoWay: true, }, - viewModel + viewModel, ); TKUnit.assertEqual(target1.get('targetProperty'), expectedText); @@ -897,7 +893,7 @@ export function test_NestedPropertiesBindingTwoTargetsAndSecondChange() { targetProperty: 'targetProperty', twoWay: true, }, - viewModel + viewModel, ); const target2 = new Label(); @@ -907,7 +903,7 @@ export function test_NestedPropertiesBindingTwoTargetsAndSecondChange() { targetProperty: 'targetProp', twoWay: true, }, - viewModel + viewModel, ); TKUnit.assertEqual(target1.get('targetProperty'), expectedText); @@ -948,7 +944,7 @@ export function test_NestedPropertiesBindingTwoTargetsAndRegularChange() { targetProperty: 'targetProperty', twoWay: true, }, - viewModel + viewModel, ); const target2 = new Label(); @@ -958,7 +954,7 @@ export function test_NestedPropertiesBindingTwoTargetsAndRegularChange() { targetProperty: 'targetProp', twoWay: true, }, - viewModel + viewModel, ); TKUnit.assertEqual(target1.get('targetProperty'), expectedText); @@ -998,7 +994,7 @@ export function test_NestedPropertiesBindingTwoTargetsAndReplacingSomeNestedObje targetProperty: 'targetProperty', twoWay: true, }, - viewModel + viewModel, ); const target2 = new Label(); @@ -1008,7 +1004,7 @@ export function test_NestedPropertiesBindingTwoTargetsAndReplacingSomeNestedObje targetProperty: 'targetProp', twoWay: true, }, - viewModel + viewModel, ); TKUnit.assertEqual(target1.get('targetProperty'), expectedText); @@ -1050,7 +1046,7 @@ export function test_NullSourcePropertyShouldNotCrash() { targetProperty: 'targetProp', expression: 'convFunc(field)', }, - model + model, ); TKUnit.assertEqual(target.get('targetProp'), convFunc(expectedValue)); @@ -1123,7 +1119,7 @@ export function test_SupportFunctionsInExpressions() { targetProperty: 'text', expression: "isVisible() ? 'visible' : 'collapsed'", }, - model + model, ); model.set('anyColor', 'blue'); @@ -1151,7 +1147,7 @@ export function test_$ValueSupportWithinExpression() { targetProperty: 'text', expression: "$value.anyColor === 'red' ? 'red' : 'blue'", }, - model + model, ); model.set('anyColor', 'blue'); @@ -1230,7 +1226,7 @@ export function test_BindingToPropertiesWithSameNames() { targetProperty: 'targetProperty', twoWay: true, }, - model + model, ); const target2 = new Label(); @@ -1240,7 +1236,7 @@ export function test_BindingToPropertiesWithSameNames() { targetProperty: 'targetProp', twoWay: true, }, - model + model, ); model.item.set('seconds', model.item.seconds + 1); @@ -1273,7 +1269,7 @@ export function test_BindingToPropertiesWithSameNamesSecondCase() { targetProperty: 'targetProperty', twoWay: true, }, - model + model, ); const target2 = new Label(); @@ -1283,7 +1279,7 @@ export function test_BindingToPropertiesWithSameNamesSecondCase() { targetProperty: 'targetProp', twoWay: true, }, - model + model, ); model.item.set('seconds', model.item.seconds + 1); @@ -1372,7 +1368,7 @@ export function test_Observable_from_nested_json_binds_correctly() { sourceProperty: 'firstObject.secondObject.dummyProperty', targetProperty: 'text', }, - model + model, ); model.get('firstObject').get('secondObject').set('dummyProperty', expectedValue); @@ -1396,7 +1392,7 @@ export function test_Observable_from_nested_json_binds_correctly_when_upper_obje sourceProperty: 'firstObject.secondObject.dummyProperty', targetProperty: 'text', }, - model + model, ); model.get('firstObject').set('secondObject', fromObject({ dummyProperty: expectedValue })); diff --git a/apps/automated/src/ui/frame/frame-tests.android.ts b/apps/automated/src/ui/frame/frame-tests.android.ts index f4df1d9160..0a18547250 100644 --- a/apps/automated/src/ui/frame/frame-tests.android.ts +++ b/apps/automated/src/ui/frame/frame-tests.android.ts @@ -1,7 +1,5 @@ -import { Frame } from '@nativescript/core/ui/frame'; import * as TKUnit from '../../tk-unit'; -import { unsetValue } from '@nativescript/core/ui/core/view'; -import { PercentLength } from '@nativescript/core/ui/styling/style-properties'; +import { PercentLength, unsetValue, Frame } from '@nativescript/core'; export * from './frame-tests-common'; export function test_percent_width_and_height_set_to_page_support() { diff --git a/apps/automated/src/ui/image/image-tests.ts b/apps/automated/src/ui/image/image-tests.ts index 9be0666b9f..70066fe12d 100644 --- a/apps/automated/src/ui/image/image-tests.ts +++ b/apps/automated/src/ui/image/image-tests.ts @@ -65,7 +65,7 @@ function runImageTestSync(image: ImageModule.Image, src: string) { image.src = src; - let imageSourceAvailable = global.isIOS ? !!image.imageSource : true; + let imageSourceAvailable = __APPLE__ ? !!image.imageSource : true; TKUnit.assertFalse(image.isLoading, 'Image.isLoading should be false.'); TKUnit.assertTrue(imageSourceAvailable, 'imageSource should be set.'); } @@ -78,7 +78,7 @@ function runImageTestAsync(image: ImageModule.Image, src: string, done: (e: any) image.off(IMAGE_LOADED_EVENT, handler); try { - let imageSourceAvailable = global.isIOS ? !!image.imageSource : true; + let imageSourceAvailable = __APPLE__ ? !!image.imageSource : true; TKUnit.assertFalse(image.isLoading, 'Image.isLoading should be false.'); TKUnit.assertTrue(imageSourceAvailable, 'imageSource should be set.'); done(null); @@ -255,7 +255,7 @@ export const test_SettingStretch_none = function () { }; function ios(func: T): T { - return global.isIOS ? func : undefined; + return __APPLE__ ? func : undefined; } export const test_SettingImageSourceWhenSizedToParentDoesNotRequestLayout = ios(() => { diff --git a/apps/automated/src/ui/label/label-tests.ts b/apps/automated/src/ui/label/label-tests.ts index 92311ab24d..ada8f29584 100644 --- a/apps/automated/src/ui/label/label-tests.ts +++ b/apps/automated/src/ui/label/label-tests.ts @@ -1,51 +1,34 @@ import * as TKUnit from '../../tk-unit'; import * as testModule from '../../ui-test'; - -//>> label-require -import * as LabelModule from '@nativescript/core/ui/label'; -// << label-require - -import * as types from '@nativescript/core/utils/types'; -import * as colorModule from '@nativescript/core/color'; -import * as utils from '@nativescript/core/utils'; -import * as observableModule from '@nativescript/core/data/observable'; -import * as bindable from '@nativescript/core/ui/core/bindable'; -import { CoreTypes, Span, FormattedString, Utils } from '@nativescript/core'; +import { Label, GridLayout, LayoutBase, StackLayout, BindingOptions, CoreTypes, Span, FormattedString, Utils, Color, Observable, path } from '@nativescript/core'; import * as labelTestsNative from './label-tests-native'; -import * as fs from '@nativescript/core/file-system'; - -import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout'; -import { GridLayout } from '@nativescript/core/ui/layouts/grid-layout'; -import { isIOS, isAndroid, isApple } from '@nativescript/core/platform'; -import { Label } from '@nativescript/core/ui/label'; -import { LayoutBase } from '@nativescript/core/ui/layouts/layout-base'; import * as helper from '../../ui-helper'; const testDir = 'ui/label'; const expectLayoutRequest = __APPLE__ && Utils.SDK_VERSION >= 18; -export class LabelTest extends testModule.UITest { - public create(): LabelModule.Label { - const label = new LabelModule.Label(); +export class LabelTest extends testModule.UITest