mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
- Prose tweaks, adding links for context - Use `If` blocks for conditional content - Restructure content to be story, component, project-ordered - Update headings to be problem-oriented
45 lines
980 B
Markdown
45 lines
980 B
Markdown
```js filename="Page.stories.js" renderer="common" language="js"
|
|
import MockDate from 'mockdate';
|
|
|
|
// ...rest of story file
|
|
|
|
export const ChristmasUI = {
|
|
async play({ mount }) {
|
|
MockDate.set('2024-12-25');
|
|
// 👇 Render the component with the mocked date
|
|
await mount();
|
|
// ...rest of test
|
|
},
|
|
};
|
|
```
|
|
|
|
```ts filename="Page.stories.ts" renderer="common" language="ts-4-9"
|
|
import MockDate from 'mockdate';
|
|
|
|
// ...rest of story file
|
|
|
|
export const ChristmasUI: Story = {
|
|
async play({ mount }) {
|
|
MockDate.set('2024-12-25');
|
|
// 👇 Render the component with the mocked date
|
|
await mount();
|
|
// ...rest of test
|
|
},
|
|
};
|
|
```
|
|
|
|
```ts filename="Page.stories.ts" renderer="common" language="ts"
|
|
import MockDate from 'mockdate';
|
|
|
|
// ...rest of story file
|
|
|
|
export const ChristmasUI: Story = {
|
|
async play({ mount }) {
|
|
MockDate.set('2024-12-25');
|
|
// 👇 Render the component with the mocked date
|
|
await mount();
|
|
// ...rest of test
|
|
},
|
|
};
|
|
```
|