mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
15
apps/app/ui-tests-app/issues/issue-3175.xml
Normal file
15
apps/app/ui-tests-app/issues/issue-3175.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<Page xmlns="http://schemas.nativescript.org/tns.xsd">
|
||||
<StackLayout>
|
||||
<Label text="100" style.fontWeight="100" />
|
||||
<Label text="200" style.fontWeight="200" />
|
||||
<Label text="300" style.fontWeight="300" />
|
||||
<Label text="400" style.fontWeight="400" />
|
||||
<Label text="normal" style.fontWeight="normal" />
|
||||
<Label text="500" style.fontWeight="500" />
|
||||
<Label text="600" style.fontWeight="600" />
|
||||
<Label text="700" style.fontWeight="700" />
|
||||
<Label text="bold" style.fontWeight="bold" />
|
||||
<Label text="800" style.fontWeight="800" />
|
||||
<Label text="900" style.fontWeight="900" />
|
||||
</StackLayout>
|
||||
</Page>
|
@ -18,6 +18,7 @@ export function pageLoaded(args: EventData) {
|
||||
examples.set("2661", "issues/issue-2661");
|
||||
examples.set("3113", "issues/issue-3113");
|
||||
examples.set("3164", "issues/issue-3164");
|
||||
examples.set("3175", "issues/issue-3175");
|
||||
|
||||
let viewModel = new SubMainPageViewModel(wrapLayout, examples);
|
||||
page.bindingContext = viewModel;
|
||||
|
@ -529,9 +529,7 @@ function test_font_shorthand_property(short: string, family: string, size: numbe
|
||||
TKUnit.assertEqual(testView.style.fontWeight, weight, "style.fontWeight");
|
||||
TKUnit.assertEqual(testView.style.fontSize, size, "style.fontSize");
|
||||
}
|
||||
|
||||
export function test_setting_font_properties_sets_native_font() {
|
||||
|
||||
if (fontModule.ios) {
|
||||
var basePath = "fonts";
|
||||
fontModule.ios.registerFont(basePath + "/Roboto-Regular.ttf");
|
||||
@ -571,6 +569,22 @@ function test_native_font(style: string, weight: string) {
|
||||
//TODO: If needed add tests for other platforms
|
||||
}
|
||||
|
||||
export function test_FontWeightsParsedAsNumbersByTheXmlParserAreConvertedToStrings() {
|
||||
var testView = new buttonModule.Button();
|
||||
// The XML parser will interpret "100" as a number and feed it to Style, so simulate this here.
|
||||
(<any>testView.style).fontWeight = 100; TKUnit.assertEqual(testView.style.fontWeight, "100");
|
||||
(<any>testView.style).fontWeight = 200; TKUnit.assertEqual(testView.style.fontWeight, "200");
|
||||
(<any>testView.style).fontWeight = 300; TKUnit.assertEqual(testView.style.fontWeight, "300");
|
||||
(<any>testView.style).fontWeight = 400; TKUnit.assertEqual(testView.style.fontWeight, "400");
|
||||
(<any>testView.style).fontWeight = "normal"; TKUnit.assertEqual(testView.style.fontWeight, "normal");
|
||||
(<any>testView.style).fontWeight = 500; TKUnit.assertEqual(testView.style.fontWeight, "500");
|
||||
(<any>testView.style).fontWeight = 600; TKUnit.assertEqual(testView.style.fontWeight, "600");
|
||||
(<any>testView.style).fontWeight = 700; TKUnit.assertEqual(testView.style.fontWeight, "700");
|
||||
(<any>testView.style).fontWeight = "bold"; TKUnit.assertEqual(testView.style.fontWeight, "bold");
|
||||
(<any>testView.style).fontWeight = 800; TKUnit.assertEqual(testView.style.fontWeight, "800");
|
||||
(<any>testView.style).fontWeight = 900; TKUnit.assertEqual(testView.style.fontWeight, "900");
|
||||
}
|
||||
|
||||
export var test_setting_button_whiteSpace_normal_sets_native = function () {
|
||||
var testView = new buttonModule.Button();
|
||||
testView.style.whiteSpace = "nowrap";
|
||||
|
@ -650,7 +650,8 @@ export class Style extends DependencyObservable implements styling.Style {
|
||||
return this._getValue(fontWeightProperty);
|
||||
}
|
||||
set fontWeight(value: string) {
|
||||
this._setValue(fontWeightProperty, value);
|
||||
let stringValue = value ? value.toString() : undefined;
|
||||
this._setValue(fontWeightProperty, stringValue);
|
||||
}
|
||||
|
||||
get font(): string {
|
||||
|
Reference in New Issue
Block a user