We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have a button component like this
<script lang="ts"> export let disabled: boolean = false; </script> <button {disabled} on:click> <slot /> </button>
I'm trying to test it like this
it('does disabled work', async () => { const { getByRole, component } = render(Button, { disabled: true, }); const button = getByRole('button'); expect(button.hasAttribute('disabled')).toBeTruthy(); <-- passes const mock = jest.fn(); component.$on('click', mock); fireEvent.click(button); expect(mock).not.toHaveBeenCalled(); <-- fails });
Shouldn't fireEvent.click(button) try to replicate what would happen if a user tried to click the button?
The text was updated successfully, but these errors were encountered:
bump? I've stumbled about the same issue today...
Sorry, something went wrong.
@testing-library/svelte pretty much only import 'fireEvent' from @testing-library/dom without any change.
The 'click on disabled' issue is reported on their repo here: testing-library/dom-testing-library#92, which itself tracks the root source to jsdom (jsdom/jsdom#2665)
As this is an upstream problem and there is not much we can do about it, I'll close the issue here.
No branches or pull requests
I have a button component like this
I'm trying to test it like this
Shouldn't fireEvent.click(button) try to replicate what would happen if a user tried to click the button?
The text was updated successfully, but these errors were encountered: