From b1687d29b2a5f30d740696868e83b1ae6d492018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E8=B4=A7=E6=9C=BA=E5=99=A8=E4=BA=BA?= Date: Sat, 20 Jul 2024 16:48:55 +0800 Subject: [PATCH] test: update test case --- tests/Range.test.tsx | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/Range.test.tsx b/tests/Range.test.tsx index e90381b14..6f7d5a220 100644 --- a/tests/Range.test.tsx +++ b/tests/Range.test.tsx @@ -751,5 +751,49 @@ describe('Range', () => { // 2 handle expect(container.querySelectorAll('.rc-slider-handle')).toHaveLength(0); }); + + it('not remove when minCount', () => { + const onChange = jest.fn(); + + const { container } = render( + ori} + />, + ); + + const handle = container.querySelector('.rc-slider-handle'); + + // Key + fireEvent.mouseEnter(handle); + fireEvent.keyDown(handle, { + keyCode: keyCode.DELETE, + }); + expect(onChange).not.toHaveBeenCalled(); + + // Mouse + doMouseMove(container, 0, 1000); + expect(onChange).toHaveBeenCalledWith([100]); + }); + + it('maxCount not add', () => { + const onChange = jest.fn(); + const { container } = render( + , + ); + + doMouseDown(container, 50, 'rc-slider', true); + expect(onChange).toHaveBeenCalledWith([0, 50]); + }); }); });