Skip to content

Commit

Permalink
Fix mock for TextInput (#28332)
Browse files Browse the repository at this point in the history
Summary:
This PR adds the `isFocused` method to the mock of the TextInput component. My understanding some of the latest changes on the TextInput to make it use a forwardRef change the way this method is mock giving an error when trying to use in on a mock.
The change suggested here fixes the issue.

## Changelog

[JavaScript] [Fixed] - Fix the mock for TextInput to support the `isFocused` method
Pull Request resolved: #28332

Reviewed By: cpojer

Differential Revision: D20538044

Pulled By: TheSavior

fbshipit-source-id: be734af105ab62ffdf9ed4017bd70845e207f8cd
  • Loading branch information
SergioEstevao authored and alloy committed Apr 8, 2020
1 parent 8e705b7 commit 9a00cec
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ jest
mockComponent('../Libraries/Text/Text', MockNativeMethods),
)
.mock('../Libraries/Components/TextInput/TextInput', () =>
mockComponent(
'../Libraries/Components/TextInput/TextInput',
MockNativeMethods,
),
mockComponent('../Libraries/Components/TextInput/TextInput', {
...MockNativeMethods,
isFocused: jest.fn(),
clear: jest.fn(),
getNativeRef: jest.fn(),
}),
)
.mock('../Libraries/Modal/Modal', () =>
mockComponent('../Libraries/Modal/Modal'),
Expand Down

0 comments on commit 9a00cec

Please sign in to comment.