[TIMOB-23500] Android: Ti.UI.Label.ellipsize should default to TruncateAt.END, but is undefined
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2016-08-24T03:29:54.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 6.0.0 |
| Components | Android |
| Labels | parity |
| Reporter | Christopher Williams |
| Assignee | Chee Kiat Ng |
| Created | 2016-06-10T19:52:30.000+0000 |
| Updated | 2016-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);
});
PR: https://github.com/appcelerator/titanium_mobile/pull/8094 I've put the default value to
falsesince it is allowed to set it totrue= TruncateAt.END andfalse= null (default; turn off ellipsizing)Adding:
Ti.UI.TEXT_ELLIPSIZE_TRUNCATE_NONEDefault:Ti.UI.TEXT_ELLIPSIZE_TRUNCATE_ENDwill output: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();Is label1 truncate at end? trueIs label2 truncate at end? falseDefault on top, _NONE at the bottom: !http://migaweb.de/ellipsize.png!PR is merged and this is fixed. But unit test need to be updated. PR coming for that.
PR here: https://github.com/appcelerator/titanium-mobile-mocha-suite/pull/2
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