User-event: Docs improvement for using `selectedRange` with userEvent.type

Created on 24 Jul 2020  路  3Comments  路  Source: testing-library/user-event

  • @testing-library/user-event version: Latest
  • Testing Framework and version: Jest
  • DOM Environment: jsdom 16

Problem description:
The use case is being able to specify how many characters should be deleted with

userEvent.type(input, `{backspace}`)

You can put this into a loop but the docs seems to suggest there is a way to use something called selectedRange, which I can't find in the codebase or in the documentation.
https://github.com/testing-library/user-event#typeelement-text-options

Suggested solution:
Improve the documentation/examples 馃榿

good first issue help wanted released

All 3 comments

Good point @ahayes91! Perhaps an example could be helpful. Something like this: https://github.com/testing-library/user-event/blob/52c333cf1ea6d961bcfea64d974ee05845c1c924/src/__tests__/type-modifiers.js#L195-L197

Would be be interested in adding an example for this to the docs?

Hello! I took this issue as my first contribution to the project. I wrote the example like the other ones in the readme were written, let me know if it needs any changes! Thanks and I hope it helps!

:tada: This issue has been resolved in version 12.0.16 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

Was this page helpful?
0 / 5 - 0 ratings