Skip to content

Commit aeb80ab

Browse files
committed
feat: test
1 parent 550ef4e commit aeb80ab

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/search.spec.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,25 @@ describe('Cascader.Search', () => {
193193
errorSpy.mockRestore();
194194
});
195195

196+
it('onChange should be triggered when click option with changeOnSelect + multiple', () => {
197+
const onChange = jest.fn();
198+
const wrapper = mount(
199+
<Cascader checkable options={options} changeOnSelect onChange={onChange} showSearch />,
200+
);
201+
doSearch(wrapper, 'toy');
202+
wrapper.find('.rc-cascader-menu-item').first().simulate('click');
203+
wrapper.find('.rc-cascader-menu-item').first().simulate('mousedown');
204+
expect(onChange).toHaveBeenCalledWith([['bamboo', 'little', 'fish']], expect.anything());
205+
206+
doSearch(wrapper, 'light');
207+
wrapper.find('.rc-cascader-menu-item').first().simulate('click');
208+
wrapper.find('.rc-cascader-menu-item').first().simulate('mousedown');
209+
expect(onChange).toHaveBeenCalledWith(
210+
[['bamboo', 'little', 'fish'], ['light']],
211+
expect.anything(),
212+
);
213+
});
214+
196215
it('onChange should be triggered when click option with multiple', () => {
197216
const onChange = jest.fn();
198217
const wrapper = mount(<Cascader checkable options={options} onChange={onChange} showSearch />);

0 commit comments

Comments
 (0)