Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions apps/tests/ui/label/label-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,40 @@ export class LabelTest extends testModule.UITest<LabelModule.Label> {
TKUnit.assertEqual(actualNative, expectedValue, "Native text not equal");
}

public test_Set_Text_Native_Null() {
var testLabel = this.testView;
var expectedValue = "";

testLabel.text = null;
var actualNative;
if (testLabel.ios) {
actualNative = testLabel.ios.text;
}
else {
this.waitUntilTestElementIsLoaded();
actualNative = testLabel.android.getText();
}

TKUnit.assertEqual(actualNative, expectedValue, "Native text not equal");
}

public test_Set_Text_Native_Undefined() {
var testLabel = this.testView;
var expectedValue = "";

testLabel.text = undefined;
var actualNative;
if (testLabel.ios) {
actualNative = testLabel.ios.text;
}
else {
this.waitUntilTestElementIsLoaded();
actualNative = testLabel.android.getText();
}

TKUnit.assertEqual(actualNative, expectedValue, "Native text not equal");
}

public test_Set_BackgroundColor_TNS() {
var label = this.testView;
var expectedValue = new colorModule.Color("Red");
Expand Down
6 changes: 4 additions & 2 deletions ui/text-base/text-base.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import definition = require("ui/text-base");
import view = require("ui/core/view");
import types = require("utils/types");
import observable = require("data/observable");
import dependencyObservable = require("ui/core/dependency-observable");
import proxy = require("ui/core/proxy");
Expand Down Expand Up @@ -100,11 +101,12 @@ export class TextBase extends view.View implements definition.TextBase, formatte
}

public _onTextPropertyChanged(data: dependencyObservable.PropertyChangeData) {
var newValue = types.isNullOrUndefined(data.newValue) ? "" : data.newValue + "";
if (this.android) {
this.android.setText(data.newValue + "");
this.android.setText(newValue);
}
else if (this.ios) {
this.ios.text = data.newValue + "";
this.ios.text = newValue;
this.style._updateTextDecoration();
this.style._updateTextTransform();
}
Expand Down