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

fix: clear function on non text inputs #262

Merged

Conversation

Meemaw
Copy link
Contributor

@Meemaw Meemaw commented May 8, 2020

element.setSelectionRange(0, element.value.length) does not work on all input types (e.g. type="number" or type"email"). See https://stackoverflow.com/questions/33406169/failed-to-execute-setselectionrange-on-htmlinputelement-the-input-elements

Using userEvent.clear on such element will throw an error:
Screenshot 2020-05-08 at 15 16 08

src/index.js Show resolved Hide resolved
@codecov
Copy link

codecov bot commented May 8, 2020

Codecov Report

Merging #262 into master will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #262      +/-   ##
==========================================
+ Coverage   98.75%   98.80%   +0.05%     
==========================================
  Files           1        1              
  Lines         160      168       +8     
  Branches       44       47       +3     
==========================================
+ Hits          158      166       +8     
  Misses          2        2              
Impacted Files Coverage Δ
src/index.js 98.80% <100.00%> (+0.05%) ⬆️

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 a0cbe27...6422916. Read the comment docs.

@Meemaw Meemaw force-pushed the fix-clear-on-non-text-inputs branch from a81b43e to f5a7606 Compare May 8, 2020 13:22
package.json Outdated Show resolved Hide resolved
@Meemaw
Copy link
Contributor Author

Meemaw commented May 13, 2020

@kentcdodds I've removed the package.json changes

@kentcdodds kentcdodds merged commit e2272ab into testing-library:master May 14, 2020
@Gpx
Copy link
Member

Gpx commented May 14, 2020

🎉 This PR is included in version 10.2.4 🎉

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.

None yet

3 participants