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
ensure onBeforeChange is called when clicking the rail #822
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/react-component/slider/5jZT5v67WDJQ9GRXeqAr2HHLDCiW |
Test case is needed |
tests/Slider.test.js
Outdated
@@ -489,13 +489,23 @@ describe('Slider', () => { | |||
|
|||
describe('click slider to change value', () => { | |||
it('ltr', () => { | |||
const onBeforeChange = jest.fn(); |
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.
Could you help create a new test case instead of modify current one?
CI broken |
Codecov Report
@@ Coverage Diff @@
## master #822 +/- ##
=======================================
Coverage 99.81% 99.81%
=======================================
Files 13 13
Lines 532 533 +1
Branches 135 135
=======================================
+ Hits 531 532 +1
Misses 1 1
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
In version 10.0.0-alpha.5, when you click the rail, the following events are fired:
onChange
,onAfterChange
. This PR ensures thatonBeforeChange
will be fired as well.Background: there has historically been some bugginess around which events are fired when clicking on the rail. In version 8.6.1, we correctly fired all three:
onBeforeChange
,onChange
,onAfterChange
.In version 9.7.5, we fired too many events when clicking on the rail:
onBeforeChange
,onChange
,onBeforeChange
,onAfterChange
.See this issue for more people that have been affected by these event firing inconsistencies: #492