mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 07:01:53 +08:00
20 lines
507 B
Plaintext
20 lines
507 B
Plaintext
```js
|
|
// tests/Button.test.js
|
|
|
|
import { render, screen } from '@testing-library/vue';
|
|
|
|
import { composeStories } from '@storybook/vue3';
|
|
|
|
import * as stories from './Button.stories';
|
|
|
|
const { Primary } = composeStories(stories);
|
|
|
|
test('reuses args from composed story', () => {
|
|
render(Primary());
|
|
|
|
const buttonElement = screen.getByRole('button');
|
|
// Testing against values coming from the story itself! No need for duplication
|
|
expect(buttonElement.textContent).toEqual(Primary.args.label);
|
|
});
|
|
```
|