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

View File

@@ -1,8 +1,5 @@
import * as TKUnit from '../tk-unit';
import { EventData, Page, NavigatedData } 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 { EventData, Page, NavigatedData, Frame, NavigationTransition, StackLayout, Color } from '@nativescript/core';
import * as helper from '../ui-helper';
import * as frame from '@nativescript/core/ui/frame';
// Creates a random colorful page full of meaningless stuff.

View File

@@ -1,10 +1,9 @@
import * as helper from '../ui-helper';
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 { NavigationEntry, NavigationTransition } from '@nativescript/core/ui/frame';
import { Page } from '@nativescript/core/ui/page';
import { CoreTypes } from '@nativescript/core';
import { CustomTransition } from './custom-transition';
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 { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
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';
// >> animation-require
import * as animation from '@nativescript/core/ui/animation';
import { CoreTypes, PercentLength } from '@nativescript/core';
// << animation-require
function prepareTest(parentHeight?: number, parentWidth?: number): Label {

View File

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

View File

@@ -1,5 +1,5 @@
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';
export function getNativeTextAlignment(label: labelModule.Label): string {

View File

@@ -1,5 +1,5 @@
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 { 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 observableModule from '@nativescript/core/data/observable';
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 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 { LayoutBase } from '@nativescript/core/ui/layouts/layout-base';
import * as helper from '../../ui-helper';
import { Span, FormattedString } from '@nativescript/core';
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 {
return textField.android.getText().toString();

View File

@@ -1,7 +1,7 @@
import * as textFieldModule from '@nativescript/core/ui/text-field';
import * as colorModule from '@nativescript/core/color';
import { getColor } from '../../ui-helper';
import { Enums } from '@nativescript/core';
import { CoreTypes } from '@nativescript/core';
export function getNativeText(textField: textFieldModule.TextField): string {
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 {
return textView.android.getText().toString();

View File

@@ -1,7 +1,7 @@
import * as textViewModule from '@nativescript/core/ui/text-view';
import * as colorModule from '@nativescript/core/color';
import { getColor } from '../../ui-helper';
import { Enums } from '@nativescript/core';
import { CoreTypes } from '@nativescript/core';
export function getNativeText(textView: textViewModule.TextView): string {
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 { StackLayout } from '@nativescript/core/ui/layouts/stack-layout';
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 { isIOS } from '@nativescript/core';
// enable the trace, it is disabled by default
Trace.enable();

View File

@@ -84,7 +84,8 @@ export function testBackgroundInternalChangedOnceOnResize() {
export function test_automation_text_set_to_native() {
var newButton = new Button();
newButton.automationText = 'Button1';
newButton.accessibilityLabel = 'Button1';
helper.getCurrentPage().content = newButton;
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 { EventData, Page } from '@nativescript/core';
import { Observable, EventData, Page } from '@nativescript/core';
export function navigatingTo(args: EventData) {
const page = <Page>args.object;