File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ class TreeNode extends React.Component {
195195 } = this . props ;
196196
197197 const clickable = onClick . toString ( ) !== TreeNode . defaultProps . onClick . toString ( ) ;
198- const inputId = `${ treeId } -${ Number . isNaN ( value ) ? value : value . split ( ' ' ) . join ( '_' ) } ` ;
198+ const inputId = `${ treeId } -${ Number . isInteger ( value ) ? value : value . split ( ' ' ) . join ( '_' ) } ` ;
199199
200200 const render = [ (
201201 < label key = { 0 } htmlFor = { inputId } >
Original file line number Diff line number Diff line change @@ -36,6 +36,15 @@ describe('<TreeNode />', () => {
3636 assert . equal ( 'planets-jupiter' , wrapper . find ( 'label' ) . prop ( 'htmlFor' ) ) ;
3737 assert . equal ( 'planets-jupiter' , wrapper . find ( 'label NativeCheckbox' ) . prop ( 'id' ) ) ;
3838 } ) ;
39+
40+ it ( 'should render a label associated with a checkbox given integer value' , ( ) => {
41+ const wrapper = shallow (
42+ < TreeNode { ...baseProps } treeId = "planets" value = { 0 } /> ,
43+ ) ;
44+
45+ assert . equal ( 'planets-0' , wrapper . find ( 'label' ) . prop ( 'htmlFor' ) ) ;
46+ assert . equal ( 'planets-0' , wrapper . find ( 'label NativeCheckbox' ) . prop ( 'id' ) ) ;
47+ } ) ;
3948 } ) ;
4049
4150 describe ( 'checked' , ( ) => {
You can’t perform that action at this time.
0 commit comments