svelte-testing-library
svelte-testing-library copied to clipboard
`disabled` property is not set
For some reason, disabled
prop does not seem to set in testing. It is missing.
How to re-produce
- Setup a component (named DisabledButton.svelte)
<button disabled>Disabled</button>
- Write this test
import DisableButton from './DisableButton.svelte'; import '@testing-library/jest-dom'; import { render, screen } from '@testing-library/svelte'; describe('DisableButton', () => { it('is disabled', () => { render(DisableButton); screen.debug(); expect(screen.getByRole('button').hasAttribute('disabled')).toBeTruthy(); }); });
Expected behavior
The test passes.
Actual behavior
It fails and debug
function prints button without disabled
prop.
I think it maybe either a bug or something is wrong in my setup.