Fix: Invalid value 500 for property fontWeight in XML

Resolves #3175
This commit is contained in:
Rossen Hristov
2016-11-28 16:42:44 +02:00
parent b650bbbb6a
commit 39113f6fdd
4 changed files with 34 additions and 3 deletions

View File

@@ -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";