Don't overrides DayPickerInput selectedDays prop#531
Conversation
|
Thanks for the PR! Wondering why tests are failing here 🤔 |
911d0a4 to
02c607e
Compare
Codecov Report
@@ Coverage Diff @@
## master #531 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 15 15
Lines 541 553 +12
Branches 113 117 +4
=====================================
+ Hits 541 553 +12
Continue to review full report at Codecov.
|
test/daypickerinput/rendering.js
Outdated
| it('should use `selectedDays` from DayPickerInput props', () => { | ||
| const wrapper = mount( | ||
| <DayPickerInput | ||
| selectedDays={new Date(2017, 1, 8)} |
There was a problem hiding this comment.
I'm not sure why you are introducing a new selectedDays prop here. The idea of this update is that it doesn't matter which day is the user clicking in the overlay: the selected days will be those coming from the dayPickerProps if present.
gpbl
left a comment
There was a problem hiding this comment.
Hey thanks for the updated and for adding a test 🙇 ! I have a comment tough :)
test/daypickerinput/rendering.js
Outdated
| wrapper.instance().showDayPicker(); | ||
| wrapper.update(); | ||
| expect(wrapper.find('.DayPicker-Day--selected')).toHaveLength(1); | ||
| expect(wrapper.find('.DayPicker-Day--selected').at(0)).toHaveText('8'); |
There was a problem hiding this comment.
So this test is OK, it should have picked the selectedDays from dayPickerProps. No need to set selectedDays in the <DayPickerInput />.
The tests we are missing is:
- if
selectedDaysis passed todayPickerProps, clicking a day in the day picker will still use the days fromdayPickerProps - if
selectedDaysis passed todayPickerProps, typing a new valid day in the day picker will still use the days fromdayPickerProps
There was a problem hiding this comment.
Oh, ok, I'll remove that extra prop, but what to do with behavior that checks by this test?
|
Awesome thanks a lot ! |
* Don't overrides DayPickerInput selectedDays prop * Extra selectedDays prop removed * Test added
This reverts commit ae71a0c.
This PR for #521.
dayPickerPropsmoved afterselectedDaysso DayPickerInput'sselectedDayswon't be overridden.