You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to figure out why it seems like the fireEvent.press function always seem to trigger a callback even though it shouldn't be registered. My use case is that I'm trying to write a test that makes sure that onPress isn't called if the component is "disabled".
Trying to mimic the behaviour below...
constMyComponent=_props=>(<View><TouchableHighlighttestID={'touchable'}><Text>{'Foo'}</Text></TouchableHighlight></View>)constpressedCallback=jest.fn()const{ getByTestId }=render(<MyComponentonPress={()=>pressedCallback('bar')}/>)fireEvent.press(getByTestId('touchable'))expect(pressedCallback).not.toBeCalled()//Expected mock function not to be called but it was called with: ["bar"]
MattAgn, CarlaTeo, Harkindey, mtakac, stackia and 4 more