Skip to content

Log when fireEvent fails to fire an event #1717

Closed as duplicate
0 of 1 issue completed
Closed as duplicate
0 of 1 issue completed
@soulfresh

Description

@soulfresh

Describe the Feature

I couldn't find a feature request for this, so apologies if this has already been requested.

It would be hugely beneficial if fireEvent could be configured to log a warning if it is unable to perform the requested event. Unfortunately, I sometimes write tests that press on disabled buttons and spend a silly amount of time debugging why my tests aren't working. I usually end up debugging down into react-native-testing-library only to find that I'm a dummy and my button has a disabled prop or some other attribute preventing the button event from firing. I would be a huge time saver if react-native-testing-library could give me a hint when I do dumb things like this.

Possible Implementations

One possibility might be to allow passing an additional debug param to fireEvent that when true will console log why fireEvent didn't work. It would be especially helpful to know what prop is preventing events from firing.

Another option that could work but isn't backwards compatible would be to return an object from fireEvent when it fails to fire an event.

Related Issues

N/A

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions