mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-07 23:12:03 +08:00
26 lines
662 B
Plaintext
26 lines
662 B
Plaintext
```tsx
|
|
// Button.test.tsx
|
|
import { test } from '@jest/globals';
|
|
import { render } from '@testing-library/react';
|
|
// 👉 Using Next.js? Import from @storybook/nextjs instead
|
|
import { composeStory } from '@storybook/react';
|
|
|
|
import meta, { Primary } from './Button.stories';
|
|
|
|
test('renders in English', async () => {
|
|
const PrimaryStory = composeStory(
|
|
Primary,
|
|
meta,
|
|
{ globals: { locale: 'en' } }, // 👈 Project annotations to override the locale
|
|
);
|
|
|
|
render(<PrimaryStory />);
|
|
});
|
|
|
|
test('renders in Spanish', async () => {
|
|
const PrimaryStory = composeStory(Primary, meta, { globals: { locale: 'es' } });
|
|
|
|
render(<PrimaryStory />);
|
|
});
|
|
```
|