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
fix: apply changes before input event #622
Conversation
Codecov Report
@@ Coverage Diff @@
## master #622 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 46 46
Lines 881 884 +3
Branches 330 330
=========================================
+ Hits 881 884 +3
Continue to review full report at Codecov.
|
🎉 This PR is included in version 13.0.13 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
@ph-fritsche Hey! 👋 Thanks for your work on this awesome library! I'm trying to figure out why tests are breaking now, either after this or #619, though this one, based on the code changes (which I don't fully understand) feels like it's the more likely culprit. So far, I've been using the React Testing Library, and using Here's a simplification, which is breaking: const handler = jest.fn();
const { container } = render(<div><input type="text" onChange={handler} /></div>);
const inputEl = container.querySelector('input');
expect(inputEl).toHaveValue('');
userEvent.type(inputEl, 'red');
expect(inputEl).toHaveValue('red');
expect(handler).toHaveBeenCalled(); // <- fails, but should succeed The above tests all pass under v13.0.10... |
To be clear, my test is breaking under 13.0.13, so it's some patch 11, 12, or 13, that's causing the issue. |
@stefcameron Yes, this fix caused #624 which is fixed in #626 . Update to the latest version and you should be good 🚀 😃 |
@ph-fritsche Nice! Glad it should be fixed already. I'll check this out in 13.0.15! |
Fixed, thank you! |
What:
Apply new value and selection range before
input
event so thatinput
handlers can use it.Get correct selection range for
[ArrowLeft]
and[ArrowRight]
when active element does not support selectionRange.Why:
Closes #515
Checklist: