File tree Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Expand file tree Collapse file tree 3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 11# CHANGELOG
22
3+ ## v1.2.3 (TBA)
4+
5+ ### Bug Fixes
6+
7+ * [ #81 ] : Fix render errors for all numeric value types
8+
39## [ v1.2.2] ( https://github.com/jakezatecky/react-checkbox-tree/compare/v1.2.1...v1.2.2 ) (2018-05-24)
410
511### Bug Fixes
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 . isInteger ( value ) ? value : value . split ( ' ' ) . join ( '_' ) } ` ;
198+ const inputId = `${ treeId } -${ String ( value ) . split ( ' ' ) . join ( '_' ) } ` ;
199199
200200 const render = [ (
201201 < label key = { 0 } htmlFor = { inputId } >
Original file line number Diff line number Diff line change @@ -45,6 +45,15 @@ describe('<TreeNode />', () => {
4545 assert . equal ( 'planets-0' , wrapper . find ( 'label' ) . prop ( 'htmlFor' ) ) ;
4646 assert . equal ( 'planets-0' , wrapper . find ( 'label NativeCheckbox' ) . prop ( 'id' ) ) ;
4747 } ) ;
48+
49+ it ( 'should render a label associated with a checkbox given float value' , ( ) => {
50+ const wrapper = shallow (
51+ < TreeNode { ...baseProps } treeId = "planets" value = { 0.25 } /> ,
52+ ) ;
53+
54+ assert . equal ( 'planets-0.25' , wrapper . find ( 'label' ) . prop ( 'htmlFor' ) ) ;
55+ assert . equal ( 'planets-0.25' , wrapper . find ( 'label NativeCheckbox' ) . prop ( 'id' ) ) ;
56+ } ) ;
4857 } ) ;
4958
5059 describe ( 'checked' , ( ) => {
You can’t perform that action at this time.
0 commit comments