We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 670432e commit 5986af1Copy full SHA for 5986af1
tests/picker.spec.tsx
@@ -119,6 +119,20 @@ describe('Basic', () => {
119
expect(wrapper.isOpen()).toBeFalsy();
120
});
121
122
+ it('fixed open need repeat trigger onOpenChange', () => {
123
+ const onOpenChange = jest.fn();
124
+ mount(<MomentPicker onOpenChange={onOpenChange} open />);
125
+
126
+ for (let i = 0; i < 10; i += 1) {
127
+ const clickEvent = new Event('click');
128
+ Object.defineProperty(clickEvent, 'target', {
129
+ get: () => document.body,
130
+ });
131
+ window.dispatchEvent(clickEvent);
132
+ expect(onOpenChange).toHaveBeenCalledTimes(i + 1);
133
+ }
134
135
136
it('disabled should not open', () => {
137
const wrapper = mount(<MomentPicker open disabled />);
138
0 commit comments