File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -297,6 +297,34 @@ describe('<CheckboxTree />', () => {
297297 } ) ;
298298 } ) ;
299299
300+ describe ( 'onClick' , ( ) => {
301+ it ( 'should pass the node clicked as the first parameter' , ( ) => {
302+ let actualNode = null ;
303+
304+ const wrapper = mount (
305+ < CheckboxTree
306+ checked = { [ ] }
307+ nodes = { [
308+ {
309+ value : 'jupiter' ,
310+ label : 'Jupiter' ,
311+ children : [
312+ { value : 'io' , label : 'Io' } ,
313+ { value : 'europa' , label : 'Europa' } ,
314+ ] ,
315+ } ,
316+ ] }
317+ onClick = { ( node ) => {
318+ actualNode = node ;
319+ } }
320+ /> ,
321+ ) ;
322+
323+ wrapper . find ( '.rct-node-clickable' ) . simulate ( 'click' ) ;
324+ assert . equal ( 'jupiter' , actualNode . value ) ;
325+ } ) ;
326+ } ) ;
327+
300328 describe ( 'onExpand' , ( ) => {
301329 it ( 'should pass the node toggled as the second parameter' , ( ) => {
302330 let actualNode = null ;
You can’t perform that action at this time.
0 commit comments