tests: color date/time ios14 tests (#9019)

This commit is contained in:
Nathanael Anderson
2020-11-11 01:14:04 -06:00
committed by GitHub
parent b3f9c0d0ac
commit 05faa867d0
2 changed files with 12 additions and 6 deletions

View File

@ -1,8 +1,8 @@
import * as TKUnit from '../../tk-unit'; import * as TKUnit from '../../tk-unit';
import * as testModule from '../../ui-test'; import * as testModule from '../../ui-test';
import * as datePickerTestsNative from './date-picker-tests-native'; import * as datePickerTestsNative from './date-picker-tests-native';
import * as color from '@nativescript/core/color';
import * as platform from '@nativescript/core/platform'; import * as platform from '@nativescript/core/platform';
import { Color } from '@nativescript/core';
// >> date-picker-require // >> date-picker-require
import * as datePickerModule from '@nativescript/core/ui/date-picker'; import * as datePickerModule from '@nativescript/core/ui/date-picker';
@ -77,10 +77,13 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke
public test_set_color() { public test_set_color() {
if (platform.Device.os === platform.platformNames.ios) { if (platform.Device.os === platform.platformNames.ios) {
this.testView.color = new color.Color('red'); const SUPPORT_TEXT_COLOR = parseFloat(platform.Device.osVersion) < 14.0;
if (SUPPORT_TEXT_COLOR) {
this.testView.color = new Color('red');
TKUnit.assertEqual(this.testView.color.ios.CGColor, this.testView.ios.valueForKey('textColor').CGColor, 'datePicker.color'); TKUnit.assertEqual(this.testView.color.ios.CGColor, this.testView.ios.valueForKey('textColor').CGColor, 'datePicker.color');
} }
} }
}
public test_WhenCreated_YearIsCurrentYear() { public test_WhenCreated_YearIsCurrentYear() {
const actualValue = this.testView.year; const actualValue = this.testView.year;

View File

@ -1,9 +1,9 @@
import * as TKUnit from '../../tk-unit'; import * as TKUnit from '../../tk-unit';
import * as testModule from '../../ui-test'; import * as testModule from '../../ui-test';
import * as timePickerTestsNative from './time-picker-tests-native'; import * as timePickerTestsNative from './time-picker-tests-native';
import * as color from '@nativescript/core/color';
import * as platform from '@nativescript/core/platform'; import * as platform from '@nativescript/core/platform';
import * as helper from '../../ui-helper'; import * as helper from '../../ui-helper';
import { Color } from '@nativescript/core';
// >> require-time-picker // >> require-time-picker
import * as timePickerModule from '@nativescript/core/ui/time-picker'; import * as timePickerModule from '@nativescript/core/ui/time-picker';
@ -50,10 +50,13 @@ export class TimePickerTest extends testModule.UITest<timePickerModule.TimePicke
// Supported in iOS only. // Supported in iOS only.
public test_set_color() { public test_set_color() {
if (platform.Device.os === platform.platformNames.ios) { if (platform.Device.os === platform.platformNames.ios) {
this.testView.color = new color.Color('red'); const SUPPORT_TEXT_COLOR = parseFloat(platform.Device.osVersion) < 14.0;
if (SUPPORT_TEXT_COLOR) {
this.testView.color = new Color('red');
TKUnit.assertEqual(this.testView.color.ios.CGColor, this.testView.ios.valueForKey('textColor').CGColor, 'timePicker.color'); TKUnit.assertEqual(this.testView.color.ios.CGColor, this.testView.ios.valueForKey('textColor').CGColor, 'timePicker.color');
} }
} }
}
public test_WhenCreated_MinuteIntervalIs1() { public test_WhenCreated_MinuteIntervalIs1() {
let actualValue = this.testView.minuteInterval; let actualValue = this.testView.minuteInterval;