From 1f6c0b4403d31e4decfbd33250d28a38b3c0ffb2 Mon Sep 17 00:00:00 2001 From: littleee Date: Mon, 2 Nov 2020 16:15:18 +0800 Subject: [PATCH] test: add test --- tests/portal.spec.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/portal.spec.tsx b/tests/portal.spec.tsx index 76edf3b3..b6bd5804 100644 --- a/tests/portal.spec.tsx +++ b/tests/portal.spec.tsx @@ -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( + + content + , + ); + + act(() => { + jest.runAllTimers(); + }); + + wrapper.find('.rc-dialog-content').simulate('mousedown'); + wrapper.find('.rc-dialog-wrap').simulate('mouseup'); + expect(onClose).not.toHaveBeenCalled(); + }); });