chore: fix automated tests

This commit is contained in:
Nathan Walker
2021-03-25 21:01:55 -07:00
parent ede1685ae2
commit 14360881e6
15 changed files with 16 additions and 24 deletions

View File

@@ -1,10 +1,9 @@
// >> observable-require // >> observable-require
import { Observable, PropertyChangeData, EventData, WrappedValue, fromObject, fromObjectRecursive } from '@nativescript/core'; import { Observable, PropertyChangeData, EventData, WrappedValue, fromObject, fromObjectRecursive, ObservableArray } from '@nativescript/core';
// << observable-require // << observable-require
import * as TKUnit from '../tk-unit'; import * as TKUnit from '../tk-unit';
import * as types from '@nativescript/core/utils/types'; import * as types from '@nativescript/core/utils/types';
import { ObservableArray } from '@nativescript/core';
var TESTED_NAME = 'tested'; var TESTED_NAME = 'tested';
class TestObservable extends Observable { class TestObservable extends Observable {

View File

@@ -1,8 +1,5 @@
import * as TKUnit from '../tk-unit'; import * as TKUnit from '../tk-unit';
import { EventData, Page, NavigatedData } from '@nativescript/core'; import { EventData, Page, NavigatedData, Frame, NavigationTransition, StackLayout, Color } from '@nativescript/core';
import { Frame, NavigationTransition } from '@nativescript/core/ui/frame';
import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
import { Color } from '@nativescript/core/color';
import * as helper from '../ui-helper'; import * as helper from '../ui-helper';
import * as frame from '@nativescript/core/ui/frame'; import * as frame from '@nativescript/core/ui/frame';
// Creates a random colorful page full of meaningless stuff. // Creates a random colorful page full of meaningless stuff.

View File

@@ -1,10 +1,9 @@
import * as helper from '../ui-helper'; import * as helper from '../ui-helper';
import * as platform from '@nativescript/core/platform'; import * as platform from '@nativescript/core/platform';
import { Trace } from '@nativescript/core'; import { Trace, CoreTypes } from '@nativescript/core';
import { Color } from '@nativescript/core/color'; import { Color } from '@nativescript/core/color';
import { NavigationEntry, NavigationTransition } from '@nativescript/core/ui/frame'; import { NavigationEntry, NavigationTransition } from '@nativescript/core/ui/frame';
import { Page } from '@nativescript/core/ui/page'; import { Page } from '@nativescript/core/ui/page';
import { CoreTypes } from '@nativescript/core';
import { CustomTransition } from './custom-transition'; import { CustomTransition } from './custom-transition';
function _testTransition(navigationTransition: NavigationTransition) { function _testTransition(navigationTransition: NavigationTransition) {

View File

@@ -4,12 +4,11 @@ import * as viewModule from '@nativescript/core/ui/core/view';
import { Label } from '@nativescript/core/ui/label'; import { Label } from '@nativescript/core/ui/label';
import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout'; import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
import * as colorModule from '@nativescript/core/color'; import * as colorModule from '@nativescript/core/color';
import { Enums } from '@nativescript/core'; import { CoreTypes, PercentLength } from '@nativescript/core';
import { AnimationPromise } from '@nativescript/core/ui/animation'; import { AnimationPromise } from '@nativescript/core/ui/animation';
// >> animation-require // >> animation-require
import * as animation from '@nativescript/core/ui/animation'; import * as animation from '@nativescript/core/ui/animation';
import { CoreTypes, PercentLength } from '@nativescript/core';
// << animation-require // << animation-require
function prepareTest(parentHeight?: number, parentWidth?: number): Label { function prepareTest(parentHeight?: number, parentWidth?: number): Label {

View File

@@ -1,6 +1,6 @@
import * as buttonModule from '@nativescript/core/ui/button'; import * as buttonModule from '@nativescript/core/ui/button';
import * as colorModule from '@nativescript/core/color'; import * as colorModule from '@nativescript/core/color';
import { Enums } from '@nativescript/core'; import { CoreTypes } from '@nativescript/core';
import { getColor } from '../../ui-helper'; import { getColor } from '../../ui-helper';
export function getNativeText(button: buttonModule.Button): string { export function getNativeText(button: buttonModule.Button): string {

View File

@@ -1,5 +1,5 @@
import * as labelModule from '@nativescript/core/ui/label'; import * as labelModule from '@nativescript/core/ui/label';
import { Enums } from '@nativescript/core'; import { CoreTypes } from '@nativescript/core';
import * as colorModule from '@nativescript/core/color'; import * as colorModule from '@nativescript/core/color';
export function getNativeTextAlignment(label: labelModule.Label): string { export function getNativeTextAlignment(label: labelModule.Label): string {

View File

@@ -1,5 +1,5 @@
import * as labelModule from '@nativescript/core/ui/label'; import * as labelModule from '@nativescript/core/ui/label';
import { Enums } from '@nativescript/core'; import { CoreTypes } from '@nativescript/core';
import * as colorModule from '@nativescript/core/color'; import * as colorModule from '@nativescript/core/color';
import { getColor } from '../../ui-helper'; import { getColor } from '../../ui-helper';

View File

@@ -10,7 +10,7 @@ import * as colorModule from '@nativescript/core/color';
import * as utils from '@nativescript/core/utils/utils'; import * as utils from '@nativescript/core/utils/utils';
import * as observableModule from '@nativescript/core/data/observable'; import * as observableModule from '@nativescript/core/data/observable';
import * as bindable from '@nativescript/core/ui/core/bindable'; import * as bindable from '@nativescript/core/ui/core/bindable';
import { CoreTypes } from '@nativescript/core'; import { CoreTypes, Span, FormattedString } from '@nativescript/core';
import * as labelTestsNative from './label-tests-native'; import * as labelTestsNative from './label-tests-native';
import * as fs from '@nativescript/core/file-system'; import * as fs from '@nativescript/core/file-system';
@@ -20,7 +20,6 @@ import { isIOS, isAndroid } from '@nativescript/core/platform';
import { Label } from '@nativescript/core/ui/label'; import { Label } from '@nativescript/core/ui/label';
import { LayoutBase } from '@nativescript/core/ui/layouts/layout-base'; import { LayoutBase } from '@nativescript/core/ui/layouts/layout-base';
import * as helper from '../../ui-helper'; import * as helper from '../../ui-helper';
import { Span, FormattedString } from '@nativescript/core';
const testDir = 'ui/label'; const testDir = 'ui/label';

View File

@@ -1,4 +1,4 @@
import { TextField, Color, Utils, Enums } from '@nativescript/core'; import { TextField, Color, Utils, CoreTypes } from '@nativescript/core';
export function getNativeText(textField: TextField): string { export function getNativeText(textField: TextField): string {
return textField.android.getText().toString(); return textField.android.getText().toString();

View File

@@ -1,7 +1,7 @@
import * as textFieldModule from '@nativescript/core/ui/text-field'; import * as textFieldModule from '@nativescript/core/ui/text-field';
import * as colorModule from '@nativescript/core/color'; import * as colorModule from '@nativescript/core/color';
import { getColor } from '../../ui-helper'; import { getColor } from '../../ui-helper';
import { Enums } from '@nativescript/core'; import { CoreTypes } from '@nativescript/core';
export function getNativeText(textField: textFieldModule.TextField): string { export function getNativeText(textField: textFieldModule.TextField): string {
return textField.ios.text; return textField.ios.text;

View File

@@ -1,4 +1,4 @@
import { TextView, Color, Utils, Enums } from '@nativescript/core'; import { TextView, Color, Utils, CoreTypes } from '@nativescript/core';
export function getNativeText(textView: TextView): string { export function getNativeText(textView: TextView): string {
return textView.android.getText().toString(); return textView.android.getText().toString();

View File

@@ -1,7 +1,7 @@
import * as textViewModule from '@nativescript/core/ui/text-view'; import * as textViewModule from '@nativescript/core/ui/text-view';
import * as colorModule from '@nativescript/core/color'; import * as colorModule from '@nativescript/core/color';
import { getColor } from '../../ui-helper'; import { getColor } from '../../ui-helper';
import { Enums } from '@nativescript/core'; import { CoreTypes } from '@nativescript/core';
export function getNativeText(textView: textViewModule.TextView): string { export function getNativeText(textView: textViewModule.TextView): string {
return textView.ios.text; return textView.ios.text;

View File

@@ -5,9 +5,8 @@ import { Button } from '@nativescript/core/ui/button';
import * as types from '@nativescript/core/utils/types'; import * as types from '@nativescript/core/utils/types';
import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout'; import { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
import { Label } from '@nativescript/core/ui/label'; import { Label } from '@nativescript/core/ui/label';
import { Trace } from '@nativescript/core'; import { Trace, isIOS } from '@nativescript/core';
import { Color } from '@nativescript/core/color'; import { Color } from '@nativescript/core/color';
import { isIOS } from '@nativescript/core';
// enable the trace, it is disabled by default // enable the trace, it is disabled by default
Trace.enable(); Trace.enable();

View File

@@ -84,7 +84,8 @@ export function testBackgroundInternalChangedOnceOnResize() {
export function test_automation_text_set_to_native() { export function test_automation_text_set_to_native() {
var newButton = new Button(); var newButton = new Button();
newButton.automationText = 'Button1'; newButton.automationText = 'Button1';
newButton.accessibilityLabel = 'Button1';
helper.getCurrentPage().content = newButton; helper.getCurrentPage().content = newButton;
TKUnit.assertEqual((<UIView>newButton.ios).accessibilityIdentifier, 'Button1', 'accessibilityIdentifier not set to native view.'); TKUnit.assertEqual((<UIView>newButton.ios).accessibilityIdentifier, 'Button1', 'accessibilityIdentifier not set to native view.');
TKUnit.assertEqual((<UIView>newButton.ios).accessibilityLabel, 'Button1', 'accessibilityIdentifier not set to native view.'); TKUnit.assertEqual((<UIView>newButton.ios).accessibilityLabel, 'Button1', 'accessibilityLabel not set to native view.');
} }

View File

@@ -1,5 +1,4 @@
import { Observable } from '@nativescript/core'; import { Observable, EventData, Page } from '@nativescript/core';
import { EventData, Page } from '@nativescript/core';
export function navigatingTo(args: EventData) { export function navigatingTo(args: EventData) {
const page = <Page>args.object; const page = <Page>args.object;