File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1212
1313* [ #127 ] : Change TypeScript definition of TreeNode's ` label ` property to ` React.ReactNode ` to better align with the PropType
1414* [ #145 ] : Fix alignment of many React properties to TypeScript typings
15+ * [ #180 ] : Fix issue where the ` id ` property did not apply to the top-level CheckboxTree container
1516
1617## [ v1.5.0] ( https://github.com/jakezatecky/react-checkbox-tree/compare/v1.4.1...v1.5.0 ) (2019-01-25)
1718
Original file line number Diff line number Diff line change @@ -342,6 +342,7 @@ class CheckboxTree extends React.Component {
342342 nodes,
343343 nativeCheckboxes,
344344 } = this . props ;
345+ const { id } = this . state ;
345346 const treeNodes = this . renderTreeNodes ( nodes ) ;
346347
347348 const className = classNames ( {
@@ -352,7 +353,7 @@ class CheckboxTree extends React.Component {
352353 } ) ;
353354
354355 return (
355- < div className = { className } >
356+ < div className = { className } id = { id } >
356357 { this . renderExpandAll ( ) }
357358 { this . renderHiddenInput ( ) }
358359 { treeNodes }
Original file line number Diff line number Diff line change @@ -217,7 +217,18 @@ describe('<CheckboxTree />', () => {
217217 } ) ;
218218
219219 describe ( 'id' , ( ) => {
220- it ( 'should pass the property directly to tree nodes' , ( ) => {
220+ it ( 'should pass the id to the top-level DOM node' , ( ) => {
221+ const wrapper = shallow (
222+ < CheckboxTree
223+ id = "my-awesome-id"
224+ nodes = { [ { value : 'jupiter' , label : 'Jupiter' } ] }
225+ /> ,
226+ ) ;
227+
228+ assert . equal ( 'my-awesome-id' , wrapper . prop ( 'id' ) ) ;
229+ } ) ;
230+
231+ it ( 'should pass the id as a property directly to tree nodes' , ( ) => {
221232 const wrapper = shallow (
222233 < CheckboxTree
223234 id = "my-awesome-id"
You can’t perform that action at this time.
0 commit comments