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(type): replace selected text #306

Closed
wants to merge 3 commits into from
Closed

feat(type): replace selected text #306

wants to merge 3 commits into from

Conversation

wKovacs64
Copy link

Closes #301

What: allowing type to replace selected text

Why: currently, type always appends to the end of the current value (ignoring selected text, which is replaced when a real user starts typing in the browser)

How: check for element.selectionEnd > element.selectionEnd and replace that segment instead of appending

Checklist:

  • Documentation
  • Tests
  • Typings
  • Ready to be merged

@kentcdodds This change (as currently implemented) breaks the ESLint complexity threshold (clocks in at 15 when the limit is 14). Do we need to simplify it somehow, adjust the rule, disable the rule, other?

Thanks.

@wKovacs64
Copy link
Author

@kayleighridd would you mind reviewing this, too? I don't think I broke your recent work (tests pass), but another set of eyes wouldn't hurt if you have the time. 🙂 Thanks.

@kentcdodds
Copy link
Member

I'm actively working on this right now (https://kcd.im/discord). I'll see if I can merge your PR, but I'm making some significant changes to how type works.

@wKovacs64
Copy link
Author

Oh! Okay.

kentcdodds added a commit that referenced this pull request Jun 4, 2020
kentcdodds added a commit that referenced this pull request Jun 4, 2020
@kentcdodds
Copy link
Member

🎉 This issue has been resolved in version 11.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@wKovacs64 wKovacs64 deleted the 301-replace-selected-text branch June 4, 2020 23:34
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.

userEvent.type does not replace selected input value
2 participants