Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
littleee committed Nov 2, 2020
1 parent 32bc281 commit 1f6c0b4
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/portal.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,22 @@ describe('Dialog.Portal', () => {
wrapper.find('.rc-dialog-content').simulate('mouseup');
expect(onClose).not.toHaveBeenCalled();
});

it('dialog dont close when mouseDown in content and mouseUp in wrap', () => {
const onClose = jest.fn();

const wrapper = mount(
<Dialog onClose={onClose} visible>
content
</Dialog>,
);

act(() => {
jest.runAllTimers();
});

wrapper.find('.rc-dialog-content').simulate('mousedown');
wrapper.find('.rc-dialog-wrap').simulate('mouseup');
expect(onClose).not.toHaveBeenCalled();
});
});

0 comments on commit 1f6c0b4

Please sign in to comment.