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

Don't overrides DayPickerInput selectedDays prop #531

Merged
merged 3 commits into from
Nov 5, 2017

Conversation

hydrognomik
Copy link
Contributor

This PR for #521. dayPickerProps moved after selectedDays so DayPickerInput's selectedDays won't be overridden.

@gpbl
Copy link
Owner

gpbl commented Oct 26, 2017

Thanks for the PR! Wondering why tests are failing here 🤔

@gpbl gpbl added this to the v6.3.0 milestone Oct 31, 2017
@codecov
Copy link

codecov bot commented Nov 1, 2017

Codecov Report

Merging #531 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #531   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          15     15           
  Lines         541    553   +12     
  Branches      113    117    +4     
=====================================
+ Hits          541    553   +12
Impacted Files Coverage Δ
src/DayPickerInput.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 90040fc...132c4b2. Read the comment docs.

it('should use `selectedDays` from DayPickerInput props', () => {
const wrapper = mount(
<DayPickerInput
selectedDays={new Date(2017, 1, 8)}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Owner

@gpbl gpbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey thanks for the updated and for adding a test 🙇 ! I have a comment tough :)

wrapper.instance().showDayPicker();
wrapper.update();
expect(wrapper.find('.DayPicker-Day--selected')).toHaveLength(1);
expect(wrapper.find('.DayPicker-Day--selected').at(0)).toHaveText('8');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 selectedDays is passed to dayPickerProps, clicking a day in the day picker will still use the days from dayPickerProps
  • if selectedDays is passed to dayPickerProps, typing a new valid day in the day picker will still use the days from dayPickerProps

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, ok, I'll remove that extra prop, but what to do with behavior that checks by this test?

@gpbl
Copy link
Owner

gpbl commented Nov 5, 2017

Awesome thanks a lot !

@gpbl gpbl merged commit ae71a0c into gpbl:master Nov 5, 2017
@hydrognomik hydrognomik deleted the selecteddays branch November 7, 2017 12:20
@gpbl gpbl modified the milestones: v6.3.0, v7.0.0 Nov 25, 2017
kimamula pushed a commit to kimamula/react-day-picker that referenced this pull request Aug 17, 2022
* Don't overrides DayPickerInput selectedDays prop

* Extra selectedDays prop removed

* Test added
kimamula pushed a commit to kimamula/react-day-picker that referenced this pull request Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants