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
  • Loading branch information
Balaji Sridharan committed Jun 24, 2024
1 parent c8c9f6f commit 088f817
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 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,8 @@ describe("DatePicker", () => {
expect(document.body.querySelector("#portal-id-dom-test")).not.toBeNull();
});

function getOnInputKeyDownStuff(opts = {}) {
const m = newDate();
function getOnInputKeyDownStuff(opts: { [key: string]: any } = {}) {

Check failure on line 1045 in src/test/datepicker_test.test.tsx

View workflow job for this annotation

GitHub Actions / update (20.x)

Unexpected any. Specify a different type
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 088f817

Please sign in to comment.