Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23500] Android: Ti.UI.Label.ellipsize should default to TruncateAt.END, but is undefined

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-08-24T03:29:54.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.0.0
ComponentsAndroid
Labelsparity
ReporterChristopher Williams
AssigneeChee Kiat Ng
Created2016-06-10T19:52:30.000+0000
Updated2016-08-29T22:18:14.000+0000

Description

According to docs, it should default to false.
it('ellipsize', function () {
		var label = Ti.UI.createLabel({
			text: 'this is some text'
		});
		should(label.ellipsize).be.a.Boolean; // undefined on Android
		should(label.getEllipsize).be.a.Function;
		should(label.ellipsize).eql(false);
		should(label.getEllipsize()).eql(false);
		label.ellipsize = true;
		should(label.getEllipsize()).eql(true);
		should(label.ellipsize).eql(true);
	});

Comments

  1. Michael Gangolf 2016-06-28

    PR: https://github.com/appcelerator/titanium_mobile/pull/8094 I've put the default value to false since it is allowed to set it to true = TruncateAt.END and false = null (default; turn off ellipsizing)
  2. Michael Gangolf 2016-06-28

    Adding: Ti.UI.TEXT_ELLIPSIZE_TRUNCATE_NONE Default: Ti.UI.TEXT_ELLIPSIZE_TRUNCATE_END
       Titanium.UI.setBackgroundColor('#000');
       var win1 = Titanium.UI.createWindow({
           title: 'win',
           backgroundColor: '#fff'
       });
       var label1 = Titanium.UI.createLabel({
           color: '#999',
           text: 'I am Window 1',
           font: {
               fontSize: 20,
           },
           width: 80,
           top: 1,
           wordWrap:false
       });
       var label2 = Titanium.UI.createLabel({
           color: '#999',
           text: 'I am Window 1',
           font: {
               fontSize: 20,
           },
           width: 80,
           top: 100,
           wordWrap:false
       });
       
       console.info("Is label1 truncate at end? " + (label1.ellipsize == Ti.UI.TEXT_ELLIPSIZE_TRUNCATE_END));
       label2.setEllipsize(Ti.UI.TEXT_ELLIPSIZE_TRUNCATE_NONE);
       console.info("Is label2 truncate at end? " + (label2.ellipsize == Ti.UI.TEXT_ELLIPSIZE_TRUNCATE_END));
       
       win1.add(label1);
       win1.add(label2);
       
       win1.open();
       
       
    will output: Is label1 truncate at end? true Is label2 truncate at end? false Default on top, _NONE at the bottom: !http://migaweb.de/ellipsize.png!
  3. Chee Kiat Ng 2016-08-23

    PR is merged and this is fixed. But unit test need to be updated. PR coming for that.
  4. Chee Kiat Ng 2016-08-24

    PR here: https://github.com/appcelerator/titanium-mobile-mocha-suite/pull/2
  5. Lokesh Choudhary 2016-08-29

    Verified the fix. Closing. Environment: Appc Studio : 4.8.0.201608221113 Ti SDK : 6.0.0.v20160829005859 Ti CLI : 5.0.9 Alloy : 1.9.1 MAC El Capitan : 10.11.6 Appc NPM : 4.2.7 Appc CLI : 6.0.0-31 Node: 4.4.4 Nexus 6 - Android 6.0.1

JSON Source