Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[jest] Fix
enabled
prop in buttons. (#3062)
## Description Currently using `enabled` prop in our buttons doesn't work. Mocks are done using `TouchableNativeFeedback` and it has `disabled` prop instead of `enabled`. This PR changes mocked version of our buttons to handle `enabled` properly. Fixes #2385 ## Test plan <details> <summary>Run the following test</summary> ```tsx import { fireEvent, render } from '@testing-library/react-native'; import Mocks from '../mocks'; describe.only('Testing disabled Button', () => { it('onPress does not trigger', function () { const onPress = jest.fn(); const { getByTestId } = render( <Mocks.RectButton testID="btn" onPress={onPress} enabled={false} /> ); const btn = getByTestId('btn'); expect(onPress).not.toHaveBeenCalled(); fireEvent.press(btn); expect(onPress).not.toHaveBeenCalled(); }); }); ``` </details>
- Loading branch information