mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 07:21:17 +08:00
25 lines
601 B
Plaintext
25 lines
601 B
Plaintext
```tsx
|
|
// Button.test.tsx
|
|
import { test } from 'vitest';
|
|
import { render } from '@testing-library/react';
|
|
import { composeStory } from '@storybook/react';
|
|
|
|
import meta, { Primary } from './Button.stories';
|
|
|
|
test('renders in English', async () => {
|
|
const PrimaryStory = composeStory(
|
|
Primary,
|
|
meta,
|
|
{ globalTypes: { locale: 'en' } } // 👈 Project annotations to override the locale
|
|
);
|
|
|
|
render(<PrimaryStory />);
|
|
});
|
|
|
|
test('renders in Spanish', async () => {
|
|
const PrimaryStory = composeStory(Primary, meta, { globalTypes: { locale: 'es' } });
|
|
|
|
render(<PrimaryStory />);
|
|
});
|
|
```
|