From 17e849dee6d3231b1f7b6dc60d33058d5784dc21 Mon Sep 17 00:00:00 2001 From: Zyf665 <1246271707@qq.com> Date: Mon, 4 Nov 2024 15:26:53 +0800 Subject: [PATCH] Add test case --- tests/range.spec.tsx | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/range.spec.tsx b/tests/range.spec.tsx index ab31b7c86..87cef745b 100644 --- a/tests/range.spec.tsx +++ b/tests/range.spec.tsx @@ -231,7 +231,7 @@ describe('Picker.Range', () => { expect(baseElement.querySelector('.rc-picker-dropdown-hidden')).toBeTruthy(); }); - it('should not be checked if the value is disabled', () => { + it('should not be checked if the startDate is disabled', () => { const onChange = jest.fn(); const { container } = render( { ['2024-10-28', '2024-11-21'], ); }); + it('should not be checked if the endDate is disabled', () => { + const onChange = jest.fn(); + const { container } = render( + date >= dayjs('2024-11-10').endOf('day')} + onChange={onChange} + />, + ); + + openPicker(container, 0); + selectCell('21', 0); + expect(onChange).toHaveBeenCalledWith( + [expect.anything(), expect.anything()], + ['2024-10-21', '2024-11-20'], + ); + }); it('should close panel when finish first choose with showTime = true and disabled = [false, true]', () => { const { baseElement } = render();