We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
preact-testing-library
preact
node
npm
yarn
Relevant code or config Button.js
const Button = ({myHandler}) => ( <button data-testid='my-button' onTouchStart={myHandler}>Click me</button> ) export default Button;
Button.test.js
import { render, fireEvent } from '@testing-library/preact'; import Button from './Button'; describe('Button behavior test:', () => { it('Should call myHandler on touchStart', () => { const mockFn = jest.fn(); const { getByTestId } = render(<Button myHandler={mockFn} />); fireEvent.touchStart(getByTestId('my-button')); expect(mockFn).toHaveBeenCalled(); }); });
What you did: Simple button component with onTouchStart event that triggers a prop method.
What happened: I can not test it due to fireEvent.touchStart is not triggering the event and not creating side effects on my component.
Problem description: I need to unit test the side effects of onTouchStart / onTouchEnd events on my components.
The text was updated successfully, but these errors were encountered:
🎉 This issue has been resolved in version 3.0.2 🎉
The release is available on:
Your semantic-release bot 📦🚀
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
preact-testing-library
version: 1.0.2preact
version: 10.3.2node
version: 13.9.0npm
(oryarn
) version: 6.13.7Relevant code or config
Button.js
Button.test.js
What you did:
Simple button component with onTouchStart event that triggers a prop method.
What happened:
I can not test it due to fireEvent.touchStart is not triggering the event and not creating side effects on my component.
Problem description:
I need to unit test the side effects of onTouchStart / onTouchEnd events on my components.
The text was updated successfully, but these errors were encountered: