storybook/docs/snippets/preact/button-test.js.mdx
2021-07-15 13:04:24 +09:00

18 lines
424 B
Plaintext

```js
// Button.test.js
import { h } from 'preact';
import { render, screen } from '@testing-library/preact';
import '@testing-library/jest-dom/extend-expect';
//👇 Imports a specific story for the test
import { Primary } from './Button.stories';
it('renders the button in the primary state', () => {
render(<Primary {...Primary.args} />);
expect(screen.getByRole('button')).toHaveTextContent('Primary');
});
```