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 {
195
195
} = this . props ;
196
196
197
197
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 ( '_' ) } ` ;
199
199
200
200
const render = [ (
201
201
< label key = { 0 } htmlFor = { inputId } >
Original file line number Diff line number Diff line change @@ -36,6 +36,15 @@ describe('<TreeNode />', () => {
36
36
assert . equal ( 'planets-jupiter' , wrapper . find ( 'label' ) . prop ( 'htmlFor' ) ) ;
37
37
assert . equal ( 'planets-jupiter' , wrapper . find ( 'label NativeCheckbox' ) . prop ( 'id' ) ) ;
38
38
} ) ;
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
+ } ) ;
39
48
} ) ;
40
49
41
50
describe ( 'checked' , ( ) => {
You can’t perform that action at this time.
0 commit comments