Skip to content

Commit

Permalink
test: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
zombieJ committed Nov 12, 2024
1 parent 4dd71ee commit 00b392e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/range.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ describe('Picker.Range', () => {
resetWarned();
global.scrollCalled = false;
jest.useFakeTimers().setSystemTime(getDay('1990-09-03 00:00:00').valueOf());
document.body.innerHTML = '';
});

afterEach(() => {
Expand Down Expand Up @@ -2054,4 +2055,20 @@ describe('Picker.Range', () => {
'rc-picker-input-active',
);
});

it('should not click to focus on next field if first field is not confirm', () => {
const onCalendarChange = jest.fn();
const { container } = render(
<DayRangePicker onCalendarChange={onCalendarChange} showTime needConfirm />,
);

// Select first field
openPicker(container, 0);
selectCell(11);
expect(onCalendarChange).toHaveBeenCalled();

// Not click confirm and click next field
openPicker(container, 1);
expect(container.querySelectorAll('.rc-picker-input')[0]).toHaveClass('rc-picker-input-active');
});
});

0 comments on commit 00b392e

Please sign in to comment.