Skip to content

Commit

Permalink
✅ Pass the default date to the getOnInputKeyDownStuff to avoid switch…
Browse files Browse the repository at this point in the history
…ing to the next month view when the current date is in the last row of the current month

- Apply this fix as the render fails to rerender days to the next month view

Closes Hacker0x01#4934
  • Loading branch information
Balaji Sridharan committed Jun 24, 2024
1 parent c8c9f6f commit 6efffd8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/test/datepicker_test.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,10 @@ describe("DatePicker", () => {
});

it("should update the preSelection state when a day is selected with Enter press", () => {
const data = getOnInputKeyDownStuff({ shouldCloseOnSelect: false });
const data = getOnInputKeyDownStuff({
shouldCloseOnSelect: false,
selected: "2024-06-06",
});

fireEvent.keyDown(data.dateInput, getKey(KeyType.ArrowDown));
const selectedDayNode = getSelectedDayNode(data.container);
Expand Down Expand Up @@ -1039,8 +1042,9 @@ describe("DatePicker", () => {
expect(document.body.querySelector("#portal-id-dom-test")).not.toBeNull();
});

function getOnInputKeyDownStuff(opts = {}) {
const m = newDate();
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function getOnInputKeyDownStuff(opts: { [key: string]: any } = {}) {
const m = newDate(opts.selected);
const copyM = newDate(m);
const testFormat = "yyyy-MM-dd";
const exactishFormat = "yyyy-MM-dd hh: zzzz";
Expand Down

0 comments on commit 6efffd8

Please sign in to comment.