user-event
user-event copied to clipboard
feat: skip special character parsing
@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 https://github.com/testing-library/user-event/issues/584#issuecomment-800922956
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"}'))
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 /
@SiebeVE Thanks for the report. The behavior described by you is unintended. A fix is applied in #588 .
Should this be closed? I noticed the original issue (#587) is.
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
.