diff --git a/tests/picker.spec.tsx b/tests/picker.spec.tsx index 4d4b31a2e..6f93b1313 100644 --- a/tests/picker.spec.tsx +++ b/tests/picker.spec.tsx @@ -119,6 +119,20 @@ describe('Basic', () => { expect(wrapper.isOpen()).toBeFalsy(); }); + it('fixed open need repeat trigger onOpenChange', () => { + const onOpenChange = jest.fn(); + mount(); + + for (let i = 0; i < 10; i += 1) { + const clickEvent = new Event('click'); + Object.defineProperty(clickEvent, 'target', { + get: () => document.body, + }); + window.dispatchEvent(clickEvent); + expect(onOpenChange).toHaveBeenCalledTimes(i + 1); + } + }); + it('disabled should not open', () => { const wrapper = mount(); expect(wrapper.isOpen()).toBeFalsy();