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 testModule from '../../ui-test';
import * as datePickerTestsNative from './date-picker-tests-native';
import * as color from '@nativescript/core/color';
import * as platform from '@nativescript/core/platform';
import { Color } from '@nativescript/core';
// >> date-picker-require
import * as datePickerModule from '@nativescript/core/ui/date-picker';
@ -77,8 +77,11 @@ export class DatePickerTest extends testModule.UITest<datePickerModule.DatePicke
public test_set_color() {
if (platform.Device.os === platform.platformNames.ios) {
this.testView.color = new color.Color('red');
TKUnit.assertEqual(this.testView.color.ios.CGColor, this.testView.ios.valueForKey('textColor').CGColor, 'datePicker.color');
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');
}
}
}

View File

@ -1,9 +1,9 @@
import * as TKUnit from '../../tk-unit';
import * as testModule from '../../ui-test';
import * as timePickerTestsNative from './time-picker-tests-native';
import * as color from '@nativescript/core/color';
import * as platform from '@nativescript/core/platform';
import * as helper from '../../ui-helper';
import { Color } from '@nativescript/core';
// >> require-time-picker
import * as timePickerModule from '@nativescript/core/ui/time-picker';
@ -50,8 +50,11 @@ export class TimePickerTest extends testModule.UITest<timePickerModule.TimePicke
// Supported in iOS only.
public test_set_color() {
if (platform.Device.os === platform.platformNames.ios) {
this.testView.color = new color.Color('red');
TKUnit.assertEqual(this.testView.color.ios.CGColor, this.testView.ios.valueForKey('textColor').CGColor, 'timePicker.color');
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');
}
}
}