mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-08 11:11:53 +08:00
27 lines
519 B
Plaintext
27 lines
519 B
Plaintext
```js
|
|
// Page.stories.js
|
|
import MockDate from 'mockdate';
|
|
|
|
import { getUserFromSession } from '#api/session.mock';
|
|
import { Page } from './Page';
|
|
|
|
export default {
|
|
component: Page,
|
|
// 👇 Set the value of Date for every story in the file
|
|
async beforeEach() {
|
|
MockDate.set('2024-02-14');
|
|
|
|
// 👇 Reset the Date after each story
|
|
return () => {
|
|
MockDate.reset();
|
|
};
|
|
},
|
|
};
|
|
|
|
export const Default = {
|
|
async play({ canvasElement }) {
|
|
// ... This will run with the mocked Date
|
|
},
|
|
};
|
|
```
|