Skip to content

Commit 82ec4d3

Browse files
committed
More test for onClick property
1 parent 0041077 commit 82ec4d3

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/CheckboxTree.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff 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;

0 commit comments

Comments
 (0)