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

feat: add userEvent.clear #233

Merged
merged 3 commits into from
Apr 23, 2020
Merged

Conversation

wachunga
Copy link
Contributor

This is a useful thing that Cypress provides. I've seen it requested a few times and recently missed it myself.

This approach closely resembles how Cypress implements it: {selectall}{backspace}. Because we don't have support for special keys yet, I simulated the relevant events but used double click for select all.

If you'd like, I can update the docs too.

@codecov
Copy link

codecov bot commented Mar 11, 2020

Codecov Report

Merging #233 into master will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #233      +/-   ##
==========================================
+ Coverage   98.63%   98.75%   +0.11%     
==========================================
  Files           1        1              
  Lines         147      160      +13     
  Branches       42       44       +2     
==========================================
+ Hits          145      158      +13     
  Misses          2        2              
Impacted Files Coverage Δ
src/index.js 98.75% <100.00%> (+0.11%) ⬆️

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 ebec144...7ffa216. Read the comment docs.

@wachunga
Copy link
Contributor Author

I wrote this in a generic way to accommodate future support of a backspace key, but that's hurting the code coverage. (No way to test it because we don't expose that yet through userEvent.) Guess I'll simplify the backspace logic until we want type to support that.

We don't need full backspace handling yet,
and it was hurting code coverage
@wachunga
Copy link
Contributor Author

wachunga commented Apr 3, 2020

@Gpx When you have a moment, could you review? Thanks!

@Gpx Gpx merged commit 61bcdb4 into testing-library:master Apr 23, 2020
@Gpx
Copy link
Member

Gpx commented Apr 23, 2020

Thank you 🙇

@Gpx
Copy link
Member

Gpx commented Apr 23, 2020

🎉 This PR is included in version 10.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants