-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Keep scroll position when prev months rendered on vertical scrollable calendar #1902
Keep scroll position when prev months rendered on vertical scrollable calendar #1902
Conversation
c473c48
to
d5b4fef
Compare
d5b4fef
to
c1c2e22
Compare
@ljharb I'm failing the coverage check but most of the lines highlighted as untested are not additions by me in this PR. Any suggestions? |
If every line you've added is fully covered - every branch - then this means you've added enough lines to change the fraction, which makes coverage decrease. The desired effect is to force you to add tests to cover the preexisting uncovered lines. However, it's fine to merge through as well; it'll just put some future PR author in the same boat. |
src/components/DayPicker.jsx
Outdated
const { | ||
orientation, daySize, isFocused, numberOfMonths, | ||
} = this.props; | ||
const { focusedDate, monthTitleHeight } = this.state; | ||
const { | ||
currentMonth, currentMonthScrollTop, focusedDate, monthTitleHeight, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentMonth, currentMonthScrollTop, focusedDate, monthTitleHeight, | |
currentMonth, | |
currentMonthScrollTop, | |
focusedDate, | |
monthTitleHeight, |
test/components/DayPicker_spec.jsx
Outdated
wrapper.setState({ | ||
currentMonth: moment().subtract(1, 'months'), | ||
}); | ||
expect(wrapper.transitionContainer.scrollTop).to.not.equal(prevScrollTop); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect(wrapper.transitionContainer.scrollTop).to.not.equal(prevScrollTop); | |
expect(wrapper.transitionContainer).to.not.have.property(’scrollTop’, prevScrollTop); |
44cfccf
to
dd091ec
Compare
dd091ec
to
399ba3c
Compare
Keep track of the scroll position so that the visible month stays in view when prev months are rendered for the vertical scrollable calendar.
Before
After