Skip to content

Commit b12c38c

Browse files
committed
Add TreeNode.props.onExpand test
1 parent dea1965 commit b12c38c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/TreeNode.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,26 @@ describe('<TreeNode />', () => {
124124
));
125125
});
126126
});
127+
128+
describe('onExpand', () => {
129+
it('should negate the expanded property and pass the current node\'s value', () => {
130+
let actual = {};
131+
132+
const wrapper = shallow(
133+
<TreeNode
134+
{...baseProps}
135+
expanded
136+
rawChildren={[{ value: 'europa', label: 'Europa' }]}
137+
value="jupiter"
138+
onExpand={(node) => {
139+
actual = node;
140+
}}
141+
/>,
142+
);
143+
144+
wrapper.find('.rct-collapse').simulate('click');
145+
146+
assert.deepEqual({ value: 'jupiter', expanded: false }, actual);
147+
});
148+
});
127149
});

0 commit comments

Comments
 (0)