Update flakey test for no-selected-start-before-selected-end #1854
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.
What's this fix?
Fixes the breaking test in master from merged in PR #1608
What happened?
The broken test was validating that a change in end date would call
deleteModifierforno-selected-start-before-selected-endon all visible days. Turns out the test was flakey because the visible days object calculated by DayPickerRangeController is determined by theinitialVisibleMonthThunk.DayPickerRangeController.jsx Line 1065.
The default
initialVisibleMonthThunkdoes not take into account a passed in end date and by defaulting to today, the test cannot rely on a hardcoded number of times thatdeleteModifierwill run. This isn't a major issue since DayPickerRangeController is most likely consumed by using the DateRangePicker kitchen sink that determinesinitialVisibleMonthThunklike soDayPickerRangeController.jsx Line 460.
Happy to update the default of DayPickerRangeController to match the default on the DateRangePicker for both consistency and expected behavior, but wanted to prioritize fixing the flakey test for now.
Let me know if this works @majapw @ljharb! 😁