Skip to content

Commit 3b7ba15

Browse files
committed
Add additional onExpand coverage
1 parent 5dfcfb0 commit 3b7ba15

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/CheckboxTree.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,31 @@ describe('<CheckboxTree />', () => {
567567
});
568568

569569
describe('onExpand', () => {
570+
it('should toggle the expansion state of the target node', () => {
571+
let actualExpanded = null;
572+
573+
const wrapper = mount(
574+
<CheckboxTree
575+
nodes={[
576+
{
577+
value: 'jupiter',
578+
label: 'Jupiter',
579+
children: [
580+
{ value: 'io', label: 'Io' },
581+
{ value: 'europa', label: 'Europa' },
582+
],
583+
},
584+
]}
585+
onExpand={(expanded) => {
586+
actualExpanded = expanded;
587+
}}
588+
/>,
589+
);
590+
591+
wrapper.find('TreeNode Button.rct-collapse-btn').simulate('click');
592+
assert.deepEqual(['jupiter'], actualExpanded);
593+
});
594+
570595
it('should pass the node toggled as the second parameter', () => {
571596
let actualNode = null;
572597

0 commit comments

Comments
 (0)