File tree Expand file tree Collapse file tree 3 files changed +16
-4
lines changed
tests/app/ui/segmented-bar
tns-core-modules/ui/segmented-bar Expand file tree Collapse file tree 3 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -270,3 +270,14 @@ export var testSelectedIndexChangedIsRaisedCorrectlyIfItemsNotBound = function (
270270 TKUnit . assertEqual ( newSelectedIndex , 1 ) ;
271271 } ) ;
272272}
273+
274+ export function test_SettingNumberAsTitleFromXML_DoesNotThrow ( ) {
275+ let segmentedBar = new segmentedBarModule . SegmentedBar ( ) ;
276+ let item = new segmentedBarModule . SegmentedBarItem ( ) ;
277+ ( < any > item ) . title = 1 ;
278+ segmentedBar . items = [ item ] ;
279+
280+ buildUIAndRunTest ( segmentedBar , function ( views : Array < View > ) {
281+ TKUnit . assertEqual ( item . title , "1" ) ;
282+ } ) ;
283+ }
Original file line number Diff line number Diff line change @@ -28,8 +28,9 @@ export class SegmentedBarItem extends bindable.Bindable implements definition.Se
2828 }
2929
3030 set title ( value : string ) {
31- if ( this . _title !== value ) {
32- this . _title = value ;
31+ let strValue = ( value !== null && value !== undefined ) ? value . toString ( ) : "" ;
32+ if ( this . _title !== strValue ) {
33+ this . _title = strValue ;
3334 this . _update ( ) ;
3435 }
3536 }
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ export class SegmentedBarItem extends common.SegmentedBarItem {
110110 var tabIndex = this . _parent . items . indexOf ( this ) ;
111111 var titleTextViewId = 16908310 ; // http://developer.android.com/reference/android/R.id.html#title
112112 var titleTextView = < android . widget . TextView > this . _parent . android . getTabWidget ( ) . getChildAt ( tabIndex ) . findViewById ( titleTextViewId ) ;
113- titleTextView . setText ( this . title || "" ) ;
113+ titleTextView . setText ( this . title + "" ) ;
114114 }
115115 }
116116}
@@ -162,7 +162,7 @@ export class SegmentedBar extends common.SegmentedBar {
162162 tabItem . _parent = this ;
163163
164164 var tab = this . android . newTabSpec ( this . getValidIndex ( index ) + "" ) ;
165- tab . setIndicator ( tabItem . title || "" ) ;
165+ tab . setIndicator ( tabItem . title + "" ) ;
166166 let that = this ;
167167 tab . setContent ( new android . widget . TabHost . TabContentFactory ( {
168168 createTabContent : function ( tag : string ) : android . view . View {
You can’t perform that action at this time.
0 commit comments