Closed
Description
The documentation is very simple and with few examples.
All of the click examples I saw, none clicks to see if the function is being called.
How to do this?
I try this, but isn't work:
import { act, fireEvent, render } from '@testing-library/svelte';
import Button from '../Button.svelte';
describe('Button', () => {
test('should click button', async () => {
const click = jest.fn();
const { container } = render(Button, { props: { click } });
const button = container.querySelector('button');
const acting = act(() => {
fireEvent.click(button);
});
await acting;
expect(click).toBeCalled();
});
});
Metadata
Metadata
Assignees
Labels
No labels