storybook/docs/snippets/vue/portable-stories-jest-override-globals.ts.mdx
Kyle Gach e09480aefb Split into three separate pages
- Organizational and prose improvements
- Remove Cypress, for now
2024-02-27 11:09:42 -07:00

25 lines
592 B
Plaintext

```ts
// Button.test.ts
import { test } from 'vitest';
import { render } from '@testing-library/vue';
import { composeStory } from '@storybook/vue3';
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());
});
```