mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: Enums > CoreTypes
Cleanup type symbol usage by consolidating to manage in one spot. This makes them easier to use as well by providing a single rollup of all the common type symbol's used throughout core.
This commit is contained in:
@@ -6,15 +6,15 @@ export function getNativeTextAlignment(label: labelModule.Label): string {
|
||||
let gravity = label.android.getGravity();
|
||||
|
||||
if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) === android.view.Gravity.LEFT) {
|
||||
return Enums.TextAlignment.left;
|
||||
return CoreTypes.TextAlignment.left;
|
||||
}
|
||||
|
||||
if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) === android.view.Gravity.CENTER_HORIZONTAL) {
|
||||
return Enums.TextAlignment.center;
|
||||
return CoreTypes.TextAlignment.center;
|
||||
}
|
||||
|
||||
if ((gravity & android.view.Gravity.HORIZONTAL_GRAVITY_MASK) === android.view.Gravity.RIGHT) {
|
||||
return Enums.TextAlignment.right;
|
||||
return CoreTypes.TextAlignment.right;
|
||||
}
|
||||
|
||||
return 'unexpected value';
|
||||
|
||||
@@ -6,11 +6,11 @@ import { getColor } from '../../ui-helper';
|
||||
export function getNativeTextAlignment(label: labelModule.Label): string {
|
||||
switch (label.ios.textAlignment) {
|
||||
case NSTextAlignment.Left:
|
||||
return Enums.TextAlignment.left;
|
||||
return CoreTypes.TextAlignment.left;
|
||||
case NSTextAlignment.Center:
|
||||
return Enums.TextAlignment.center;
|
||||
return CoreTypes.TextAlignment.center;
|
||||
case NSTextAlignment.Right:
|
||||
return Enums.TextAlignment.right;
|
||||
return CoreTypes.TextAlignment.right;
|
||||
default:
|
||||
return 'unexpected value';
|
||||
}
|
||||
|
||||
@@ -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 { Enums } from '@nativescript/core';
|
||||
import { CoreTypes } from '@nativescript/core';
|
||||
import * as labelTestsNative from './label-tests-native';
|
||||
import * as fs from '@nativescript/core/file-system';
|
||||
|
||||
@@ -489,7 +489,7 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
|
||||
const actualResult = view.style.textAlignment;
|
||||
TKUnit.assertEqual(actualResult, this.expectedTextAlignment);
|
||||
|
||||
page.addCss('label { text-align: ' + Enums.TextAlignment.left + '; }');
|
||||
page.addCss('label { text-align: ' + CoreTypes.TextAlignment.left + '; }');
|
||||
TKUnit.assertEqual(view.style.textAlignment, view.style.textAlignment);
|
||||
}
|
||||
|
||||
@@ -500,7 +500,7 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
|
||||
|
||||
view.id = 'testLabel';
|
||||
page.addCss('#testLabel { text-align: ' + this.expectedTextAlignment + '; }');
|
||||
page.addCss('label { text-align: ' + Enums.TextAlignment.left + '; }');
|
||||
page.addCss('label { text-align: ' + CoreTypes.TextAlignment.left + '; }');
|
||||
|
||||
const actualResult = view.style.textAlignment;
|
||||
// actual result is taken from #testLabel tag, because it has a greater priority (id vs type).
|
||||
@@ -585,8 +585,8 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
|
||||
this.waitUntilTestElementIsLoaded();
|
||||
view.setInlineStyle('text-transform: uppercase; text-decoration: underline; letter-spacing: 1;');
|
||||
|
||||
TKUnit.assertEqual(view.style.textTransform, Enums.TextTransform.uppercase, 'TextTransform');
|
||||
TKUnit.assertEqual(view.style.textDecoration, Enums.TextDecoration.underline, 'TextDecoration');
|
||||
TKUnit.assertEqual(view.style.textTransform, CoreTypes.TextTransform.uppercase, 'TextTransform');
|
||||
TKUnit.assertEqual(view.style.textDecoration, CoreTypes.TextDecoration.underline, 'TextDecoration');
|
||||
TKUnit.assertEqual(view.style.letterSpacing, 1, 'LetterSpacing');
|
||||
}
|
||||
|
||||
@@ -597,8 +597,8 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
|
||||
view.formattedText = formattedString;
|
||||
view.setInlineStyle('text-transform: uppercase; text-decoration: underline; letter-spacing: 1;');
|
||||
|
||||
TKUnit.assertEqual(view.style.textTransform, Enums.TextTransform.uppercase, 'TextTransform');
|
||||
TKUnit.assertEqual(view.style.textDecoration, Enums.TextDecoration.underline, 'TextDecoration');
|
||||
TKUnit.assertEqual(view.style.textTransform, CoreTypes.TextTransform.uppercase, 'TextTransform');
|
||||
TKUnit.assertEqual(view.style.textDecoration, CoreTypes.TextDecoration.underline, 'TextDecoration');
|
||||
TKUnit.assertEqual(view.style.letterSpacing, 1, 'LetterSpacing');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user