Skip to content

Commit

Permalink
Merge pull request #5138 from qburst/issue-5137/fix/date-picker-test-…
Browse files Browse the repository at this point in the history
…case

Fix #5137: 🧪✅ Fix the accidental change of the complete month issue with the test cases by selecting to a earlier date in a month
  • Loading branch information
martijnrusschen authored Sep 30, 2024
2 parents 84624f1 + b233974 commit ce95e64
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/test/datepicker_test.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1615,8 +1615,12 @@ describe("DatePicker", () => {
});

it("should be possible to preSelect minDate (no maxDate set)", () => {
const minDate = new Date("2024-10-02");
const selected = minDate;

const data = getOnInputKeyDownStuff({
minDate: newDate(),
selected,
minDate,
});
fireEvent.keyDown(data.dateInput, getKey(KeyType.ArrowDown));
const selectedDayNode = getSelectedDayNode(data.container);
Expand All @@ -1632,9 +1636,14 @@ describe("DatePicker", () => {
});

it("should be possible to preSelect minDate (maxDate set)", () => {
const minDate = new Date("2024-10-02");
const maxDate = addDays(minDate, 20);
const selected = minDate;

const data = getOnInputKeyDownStuff({
minDate: newDate(),
maxDate: addDays(newDate(), 20),
selected,
minDate,
maxDate,
});
fireEvent.keyDown(data.dateInput, getKey(KeyType.ArrowDown));
const selectedDayNode = getSelectedDayNode(data.container);
Expand Down

0 comments on commit ce95e64

Please sign in to comment.