mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 03:31:45 +08:00
Mark text property as special and set it with a string comming from builder.
This commit is contained in:
@ -900,3 +900,15 @@ export function test_hasSourceCodeLocations() {
|
||||
var labelSource = Source.get(label);
|
||||
TKUnit.assertEqual(labelSource.toString(), "file:///app/" + basePath + "examples/test-page.xml:3:5");
|
||||
}
|
||||
|
||||
export function test_Setting_digits_for_text_Label_is_not_converted_to_number() {
|
||||
var p = <Page>builder.parse('<Page><Label id="testLabel" text="01234"/></Page>');
|
||||
var testLabel = <Label>p.getViewById("testLabel");
|
||||
TKUnit.assertEqual(testLabel.text, "01234");
|
||||
}
|
||||
|
||||
export function test_Setting_digits_for_text_Button_is_not_converted_to_number() {
|
||||
var p = <Page>builder.parse('<Page><Button id="testButton" text="01234"/></Page>');
|
||||
var testButton = <Button>p.getViewById("testButton");
|
||||
TKUnit.assertEqual(testButton.text, "01234");
|
||||
}
|
||||
|
@ -29,6 +29,9 @@ function ensureVisualState() {
|
||||
registerSpecialProperty("class", (instance: definition.View, propertyValue: string) => {
|
||||
instance.className = propertyValue;
|
||||
});
|
||||
registerSpecialProperty("text", (instance, propertyValue) => {
|
||||
instance.set("text", propertyValue);
|
||||
});
|
||||
|
||||
function getEventOrGestureName(name: string): string {
|
||||
return name.indexOf("on") === 0 ? name.substr(2, name.length - 2) : name;
|
||||
|
Reference in New Issue
Block a user