Skip to content

Commit 00b392e

Browse files
committed
test: add test case
1 parent 4dd71ee commit 00b392e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/range.spec.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ describe('Picker.Range', () => {
4949
resetWarned();
5050
global.scrollCalled = false;
5151
jest.useFakeTimers().setSystemTime(getDay('1990-09-03 00:00:00').valueOf());
52+
document.body.innerHTML = '';
5253
});
5354

5455
afterEach(() => {
@@ -2054,4 +2055,20 @@ describe('Picker.Range', () => {
20542055
'rc-picker-input-active',
20552056
);
20562057
});
2058+
2059+
it('should not click to focus on next field if first field is not confirm', () => {
2060+
const onCalendarChange = jest.fn();
2061+
const { container } = render(
2062+
<DayRangePicker onCalendarChange={onCalendarChange} showTime needConfirm />,
2063+
);
2064+
2065+
// Select first field
2066+
openPicker(container, 0);
2067+
selectCell(11);
2068+
expect(onCalendarChange).toHaveBeenCalled();
2069+
2070+
// Not click confirm and click next field
2071+
openPicker(container, 1);
2072+
expect(container.querySelectorAll('.rc-picker-input')[0]).toHaveClass('rc-picker-input-active');
2073+
});
20572074
});

0 commit comments

Comments
 (0)