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: skip special character parsing #586

Open
ph-fritsche opened this issue Mar 17, 2021 · 4 comments
Open

feat: skip special character parsing #586

ph-fritsche opened this issue Mar 17, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@ph-fritsche
Copy link
Member

@ph-fritsche Maybe add an option to skip detection of key descriptors? Something like:

userEvent.type(input, '{"foo":"bar"}', { skipSpecialCharacters: true })

Originally posted by @lynxtaa in #584 (comment)


An alternative might be to export this workaround as a utility:

userEvent.type(input, '{"foo":"bar"}'.replace(/[{[]/g, '$&$&'))
// would become
userEvent.type(input, escapeKeyboardInput('{"foo":"bar"}'))
@ph-fritsche ph-fritsche added the enhancement New feature or request label Mar 17, 2021
@SiebeVE
Copy link

SiebeVE commented Mar 17, 2021

When typing a : or a /, it is also escaped/removed from the input value.
See: https://codesandbox.io/s/user-event-type-url-sc8by?file=/src/__tests__/App.test.js

Escaping them with the provided regex helps with the : but not with the /

@ph-fritsche
Copy link
Member Author

@SiebeVE Thanks for the report. The behavior described by you is unintended. A fix is applied in #588 .

@nickserv
Copy link
Member

Should this be closed? I noticed the original issue (#587) is.

@ph-fritsche
Copy link
Member Author

ph-fritsche commented Mar 18, 2021

Should this be closed? I noticed the original issue (#587) is.

Nope. I've extracted that comment to a new issue because there was a bug parsing /.
This issue is about adding a feature to ease escaping characters for type and keyboard.

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

No branches or pull requests

3 participants