Skip to content

add jest utils  #110

Closed
Closed
@IvanIhnatsiuk

Description

@IvanIhnatsiuk

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
Hi @kirillzyusko, Thanks a lot for the library. I would like to suggest you implementation of jestUtils, because It would be really great to have possibility to mock keyboard events in jest.

Describe the solution you'd like
A clear and concise description of what you want to happen.

create a mock implementation for opening/closing keyboard events. In jest it will look like this:

const { getByTestId } = render(<SomeComponentWithKeyboardHandler />);

expect(getByTestId("keyboardEventsView").toHaveAnimatedStyle({
 height: 0,
}) // or just simple style if you use Animated from RN core;

RNKeyboardHandler.openKeyboard(state);  // state - height, progress

expect(getByTestId("keyboardEventsView").toHaveAnimatedStyle({
 height: 100,
}) 

RNKeyboardHandler.hideKeyboard(state);  // state - height, progress

expect(getByTestId("keyboardEventsView").toHaveAnimatedStyle({
 height: 0,
}) 

Additional context
Add any other context or screenshots about the feature request here.
I have some ideas how to implement this logic and we can contact to discuss it :)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions