Skip to content

Commit

Permalink
Merge pull request #4935 from qburst/issue-4934/fix/datepicker-test-case
Browse files Browse the repository at this point in the history
Fix #4934: ✅ Fix the broken test case in datepicker_test.test.js
  • Loading branch information
martijnrusschen authored Jun 24, 2024
2 parents b6636f2 + 6efffd8 commit 5cbc3c9
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 5cbc3c9

Please sign in to comment.