mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
TextView and TextField shows null and undefined fixed
This commit is contained in:
@@ -69,6 +69,31 @@ export var testSetText = function () {
|
||||
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
|
||||
});
|
||||
}
|
||||
|
||||
export var testSetTextNull = function () {
|
||||
helper.buildUIAndRunTest(_createTextFieldFunc(), function (views: Array<viewModule.View>) {
|
||||
var textField = <textFieldModule.TextField>views[0];
|
||||
|
||||
textField.text = null;
|
||||
|
||||
var expectedValue = "";
|
||||
var actualValue = textFieldTestsNative.getNativeText(textField);
|
||||
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
|
||||
});
|
||||
}
|
||||
|
||||
export var testSetTextUndefined = function () {
|
||||
helper.buildUIAndRunTest(_createTextFieldFunc(), function (views: Array<viewModule.View>) {
|
||||
var textField = <textFieldModule.TextField>views[0];
|
||||
|
||||
textField.text = undefined;
|
||||
|
||||
var expectedValue = "";
|
||||
var actualValue = textFieldTestsNative.getNativeText(textField);
|
||||
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
|
||||
});
|
||||
}
|
||||
|
||||
/* tslint:disable */
|
||||
export var testSetHintToNumber = function () {
|
||||
helper.buildUIAndRunTest(_createTextFieldFunc(), function (views: Array<viewModule.View>) {
|
||||
|
||||
@@ -70,6 +70,30 @@ export var testSetText = function () {
|
||||
});
|
||||
}
|
||||
|
||||
export var testSetTextNull = function () {
|
||||
helper.buildUIAndRunTest(_createTextViewFunc(), function (views: Array<viewModule.View>) {
|
||||
var textView = <textViewModule.TextView>views[0];
|
||||
|
||||
textView.text = null;
|
||||
|
||||
var expectedValue = "";
|
||||
var actualValue = textViewTestsNative.getNativeText(textView);
|
||||
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
|
||||
});
|
||||
}
|
||||
|
||||
export var testSetTextUndefined = function () {
|
||||
helper.buildUIAndRunTest(_createTextViewFunc(), function (views: Array<viewModule.View>) {
|
||||
var textView = <textViewModule.TextView>views[0];
|
||||
|
||||
textView.text = undefined;
|
||||
|
||||
var expectedValue = "";
|
||||
var actualValue = textViewTestsNative.getNativeText(textView);
|
||||
TKUnit.assert(actualValue === expectedValue, "Actual: " + actualValue + "; Expected: " + expectedValue);
|
||||
});
|
||||
}
|
||||
|
||||
// Supported for ios only.
|
||||
if (platform.device.os === platform.platformNames.ios) {
|
||||
exports.test_set_color = function () {
|
||||
|
||||
Reference in New Issue
Block a user