Skip to content

Commit cc33709

Browse files
committed
Fix text & fromattedText failing tests
1 parent eede9c2 commit cc33709

File tree

6 files changed

+15
-20
lines changed

6 files changed

+15
-20
lines changed

tests/app/ui/tab-view/tab-view-tests.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ export class TabViewTest extends testModule.UITest<tabViewModule.TabView> {
330330
assertFontsAreEqual(tabViewTestsNative.getNativeFont(this.testView), nativeFont, "Font must be bold 12 monospace after rebinding items.");
331331
//console.log(`>>>>>>>>>>>>> nativeFont: ${fontToString(nativeFont)}`);
332332

333-
console.log(`>>>>>>>>>>>>> RESET`);
333+
//console.log(`>>>>>>>>>>>>> RESET`);
334334
this.testView.style.font = unsetValue;
335335
assertFontsAreEqual(tabViewTestsNative.getNativeFont(this.testView), originalFont, "Font must be the original one after resetting the style.");
336336
}

tests/app/xml-declaration/xml-declaration-tests.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,8 @@ export function test_parseSpansDirectlyOnLabel() {
700700
function testAction(views: Array<viewModule.View>) {
701701
var page = <Page>views[0];
702702
var testLabel = <Label>page.getViewById("testLabel");
703-
TKUnit.assertEqual(testLabel.formattedText + "", "We areAwesome", "Formatted string should be set");
704-
TKUnit.assertEqual(testLabel.text + "", "We areAwesome", "Formatted string should be set");
703+
TKUnit.assertEqual(testLabel.formattedText + "", "We areAwesome", "formattedText");
704+
TKUnit.assertEqual(testLabel.text + "", "We areAwesome", "text");
705705
}
706706

707707
helper.navigate(function () { return p; });
@@ -713,8 +713,8 @@ export function test_parseSpansDirectlyOnButton() {
713713
function testAction(views: Array<viewModule.View>) {
714714
var page = <Page>views[0];
715715
var testButton = <Button>page.getViewById("testButton");
716-
TKUnit.assertEqual(testButton.formattedText + "", "We areAwesome", "Formatted string should be set");
717-
TKUnit.assertEqual(testButton.text + "", "We areAwesome", "Formatted string should be set");
716+
TKUnit.assertEqual(testButton.formattedText + "", "We areAwesome", "formattedText");
717+
TKUnit.assertEqual(testButton.text + "", "We areAwesome", "text");
718718
}
719719

720720
helper.navigate(function () { return p; });
@@ -726,8 +726,8 @@ export function test_parseFormattedStringWithoutFormattedText() {
726726
function testAction(views: Array<viewModule.View>) {
727727
var page = <Page>views[0];
728728
var testButton = <Button>page.getViewById("testButton");
729-
TKUnit.assertEqual(testButton.formattedText + "", "author num_comments", "Formatted string should be set");
730-
TKUnit.assertEqual(testButton.text + "", "author num_comments", "Formatted string should be set");
729+
TKUnit.assertEqual(testButton.formattedText + "", "author num_comments", "formattedText");
730+
TKUnit.assertEqual(testButton.text + "", "author num_comments", "text");
731731
}
732732

733733
helper.navigate(function () { return p; });
@@ -739,8 +739,8 @@ export function test_parseFormattedStringFullSyntax() {
739739
function testAction(views: Array<viewModule.View>) {
740740
var page = <Page>views[0];
741741
var testButton = <Button>page.getViewById("testButton");
742-
TKUnit.assertEqual(testButton.formattedText + "", "author num_comments", "Formatted string should be set");
743-
TKUnit.assertEqual(testButton.text + "", "author num_comments", "Formatted string should be set");
742+
TKUnit.assertEqual(testButton.formattedText + "", "author num_comments", "formattedText");
743+
TKUnit.assertEqual(testButton.text + "", "author num_comments", "text");
744744
}
745745

746746
helper.navigate(function () { return p; });
@@ -752,8 +752,8 @@ export function test_parseSpansDirectlyToFormattedString() {
752752
function testAction(views: Array<viewModule.View>) {
753753
var page = <Page>views[0];
754754
var testButton = <Button>page.getViewById("testButton");
755-
TKUnit.assertEqual(testButton.formattedText + "", "author num_comments", "Formatted string should be set");
756-
TKUnit.assertEqual(testButton.text + "", "author num_comments", "Formatted string should be set");
755+
TKUnit.assertEqual(testButton.formattedText + "", "author num_comments", "formattedText");
756+
TKUnit.assertEqual(testButton.text + "", "author num_comments", "text");
757757
}
758758

759759
helper.navigate(function () { return p; });

tns-core-modules/ui/text-base/text-base.android.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class TextBase extends TextBaseCommon {
2828
let spannableStringBuilder = createSpannableStringBuilder(value);
2929
const text = (spannableStringBuilder === null || spannableStringBuilder === undefined) ? '' : <any>spannableStringBuilder;
3030
this._nativeView.setText(text);
31+
textProperty.nativeValueChange(this, (value === null || value === undefined) ? '' : value.toString());
3132

3233
if (spannableStringBuilder && this._nativeView instanceof android.widget.Button &&
3334
!(this._nativeView.getTransformationMethod() instanceof TextTransformation)){

tns-core-modules/ui/text-base/text-base.ios.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ export class TextBase extends TextBaseCommon {
4949
let nativeView = this.nativeView;
5050
if (nativeView instanceof UIButton) {
5151
nativeView.setAttributedTitleForState(mas, UIControlState.Normal);
52-
} else {
52+
}
53+
else {
5354
nativeView.attributedText = mas;
5455
}
56+
textProperty.nativeValueChange(this, (value === null || value === undefined) ? '' : value.toString());
5557
}
5658

5759
//Color

tns-core-modules/ui/text-field/text-field.ios.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ class UITextFieldDelegateImpl extends NSObject implements UITextFieldDelegate {
4040
}
4141

4242
owner.dismissSoftInput();
43-
44-
// if (owner.formattedText) {
45-
// formattedTextProperty.nativeValueChange(owner, textField.attributedText);
46-
// }
4743
}
4844
}
4945

tns-core-modules/ui/text-view/text-view.ios.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,6 @@ class UITextViewDelegateImpl extends NSObject implements UITextViewDelegate {
3939

4040
owner.dismissSoftInput();
4141
owner._refreshHintState(owner.hint, textView.text);
42-
43-
// if (owner.formattedText) {
44-
// formattedTextProperty.nativeValueChange(owner, textView.attributedText);
45-
// }
4642
}
4743
}
4844

0 commit comments

Comments
 (0)