Skip to content

Add fireEvent.blur support #100

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

Closed
wants to merge 3 commits into from

Conversation

danahartweg
Copy link
Contributor

Summary

There is not yet support for calling text input blur events via fireEvent. This PR adds that support.

Test plan

  • Query the test instance for a react native TextInput
  • Call fireEvent.blur() on the TextInput test instance
  • Verify the supplied handler is called properly

@thymikee
Copy link
Member

Thanks for your PR, it's greatly appreciated. However, with this mindset we would have to implement every event out there, which we'd like to avoid because of pain to maintain it. Especially that this library aims to support any React application, not only React Native.

We try to keep the fireEvent API as small as possible, because you can always fire:

fireEvent(getByTestId('id'), 'blur')

In a way of exception the press and changeText are exposed, because they're used pretty often, at least in our experience. Maybe we can document the generic fireEvent somehow better, perhaps add more examples of using it with various events?

@danahartweg
Copy link
Contributor Author

danahartweg commented Dec 22, 2018

@thymikee that makes a lot of sense! Honestly, I should have come to that conclusion when diving into the code (and initially looking at the docs), I just didn't even think about it since there were a couple of them aliased. Basically, I didn't look closely enough.

I'll close this out and add some additional documentation instead =)

@thymikee
Copy link
Member

I'll close this out and add some additional documentation instead =)

That would be lovely, thanks!

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

Successfully merging this pull request may close these issues.

2 participants