Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Case Failing Due to Incomplete Data Display in DatePicker Component #4283

Closed
balajis-qb opened this issue Oct 1, 2023 · 3 comments · Fixed by #4284 or jones58/personal-knowledge-wiki#29 · May be fixed by rowidanagah/EduMentorMate#9
Assignees

Comments

@balajis-qb
Copy link

Description:

Issue:

The test case located in datepicker_test.test.js, within the describe("selectsRange with inline") block and named it("should change dates of range change startDate when endDate set before startDate") is currently failing under specific conditions.

Problem:

In the above mentioned test-case, we attempt to find a date three days before the current date within a DatePicker component.
Test case issue

However, this test case is failing in certain scenarios. The issue arises when the current date falls at the beginning of a month. In such cases, the DatePicker component does not display the previous month's data, which prevents us from selecting a date three days before the current date.
The issue screenshot

To Reproduce

Normally, this issue will not occur, but I accidentally caught it on Oct. 1, 2023, as there were no fall-over days from last month in this month's week, so the component is not rendering the last month's data.
Issue Screenshot

Suggested Solution:

To address this issue, we propose the following solution:

  1. When the current date is at the beginning of the month and the DatePicker component does not display the previous month's data, we should navigate to the previous month programmatically.
  2. After navigating to the previous month, we can then attempt to select the desired date three days before the current date.

Expected behavior

With the suggested solution in place, the test case should be able to find and select a date three days before the current date, regardless of whether it falls at the beginning of the month.

Screenshots

The issue screenshot

@balajis-qb
Copy link
Author

You can assign this issue to me. I fixed the test case, I'll raise a PR for it

@martijnrusschen
Copy link
Member

Nice catch, yes this test needs to be fixed. Pretty useless if it doesn't work on the 1st of the month :)

balajis-qb pushed a commit to qburst/react-datepicker-3 that referenced this issue Oct 1, 2023
Addressed the issue in the 'it("should change dates of range change startDate when endDate set before startDate")' test case in 'datepicker_test.test.js' where the test was failing under specific conditions. The problem occurred when attempting to select a date three days before the current date, especially when the current date fell at the beginning of a month. The fix includes logic to detect and navigate to the previous month when necessary, allowing the test case to select the desired date correctly.

Closes Hacker0x01#4283
@balajis-qb
Copy link
Author

Thank you @martijnrusschen for assigning the issue. I fixed the test case. Kindly review my PR #4284 and let me know if any changes required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment