Skip to content

Commit be51de6

Browse files
committed
test: coverage
1 parent fd508bd commit be51de6

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/Select.test.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@ describe('Select.Basic', () => {
5151
inputFilterTest('single');
5252
openControlledTest('single');
5353

54+
it('should trigger close event when clicking on Select with open, value and allowClear', async () => {
55+
const onPopupVisibleChange = jest.fn();
56+
const { container } = render(
57+
<Select open value="1" allowClear onPopupVisibleChange={onPopupVisibleChange}>
58+
<Option value="1">One</Option>
59+
<Option value="2">Two</Option>
60+
</Select>,
61+
);
62+
63+
// Click on the Select should trigger close event
64+
fireEvent.mouseDown(container.querySelector('.rc-select-clear'));
65+
await waitFakeTimer();
66+
expect(onPopupVisibleChange).toHaveBeenCalledWith(false);
67+
});
68+
5469
describe('render', () => {
5570
function genSelect(props?: Partial<SelectProps>) {
5671
return (

0 commit comments

Comments
 (0)