Skip to content

Commit

Permalink
Update Calendar to fixed "now" date for snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Dec 7, 2023
1 parent e3f7865 commit cea60d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Preview } from "@storybook/svelte";
import { initialize, mswLoader } from "msw-storybook-addon";
import { mockDateDecorator } from "storybook-mock-date-decorator";

import "../src/langs/i18n.js";
import "../src/style/variables.css";
Expand All @@ -24,4 +25,6 @@ const preview: Preview = {
loaders: [mswLoader],
};

export let decorators = [mockDateDecorator];

export default preview;
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
"react-dom": "^18.2.0",
"serve": "^14.2.0",
"storybook": "7.5.3",
"storybook-mock-date-decorator": "^1.0.1",
"svelte-jester": "^3.0.0",
"tape": "^5.7.2"
},
Expand Down
5 changes: 3 additions & 2 deletions src/common/stories/Calendar.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ import type { Meta, StoryObj } from "@storybook/svelte";
import "@/langs/i18n.js";
import Calendar from "../Calendar.svelte";

// More on how to set up stories at: https://storybook.js.org/docs/7.0/svelte/writing-stories/introduction
const meta: Meta<Calendar> = {
title: "Common/Calendar",
component: Calendar,
tags: ["autodocs"],
argTypes: {
value: { control: { type: "date" } },
},
parameters: {
date: new Date("December 5, 2023 10:00:00"),
},
};

export default meta;
type Story = StoryObj<Calendar>;

// More on writing stories with args: https://storybook.js.org/docs/7.0/svelte/writing-stories/args
export const Default: Story = {
args: {},
};

0 comments on commit cea60d6

Please sign in to comment.