Fix #5137: Fix the accidental change of the complete month issue with the test cases by selecting to a earlier date in a month #33
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes Hacker0x01#5137
Description
I accidentally found this issue with the existing test cases. The issue we're having is with the test module
datepicker_test.test.js
. There currently 2 test blocks are having an issue as I mentioned in the attached screenshotDatePicker › should be possible to preSelect minDate (no maxDate set)
DatePicker › should be possible to preSelect minDate (maxDate set)
The Problem
I shared one of the failed test cases in the above screenshot. The issue there is we're initially getting a selected day using
const selectedDayNode = getSelectedDayNode(data.container)
and then doing right and left arrow click over it. This test case will work in most of the days except the last day of a month. Because, let's consider 30th Sept, 2024 as the selected date. When the user press right, a new month view will get rendered and then the existing selectedDayNode will not be available to us anymore. But in our code we didn't refetch the selectedDayNode and do Left click on it. So only the left click didn't get fired and the test case failed.If the selected date is not the end of the month, this test case will work. Because, eventhough the actual selecteDayNode gets changed to the next date on the initial right arrow click, but still the date we stored in selecteDayNode is still accessible to us and left click over it, will inturn handled by the corresponding component and the test case will pass.
The same issue happens in the other mentioned test case
Possible Fixes:
There are 2 ways to fix the issue
I fixed the issue in the 2nd way as that requires less code change.
Contribution checklist