Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import * as locales from '@sl-design-system/locales';
import { type Preview } from '@storybook/web-components-vite';
import { INITIAL_VIEWPORTS } from 'storybook/viewport';
import { updateTheme, themes } from './themes.js';
import MockDate from 'mockdate';

if (!import.meta.env?.DEV) {
MockDate.set('2025-06-01T00:00:00Z');
}

const { setLocale } = configureLocalization({
sourceLocale: locales.sourceLocale,
Expand Down
5 changes: 5 additions & 0 deletions chromatic/.storybook/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { type Preview } from '@storybook/web-components';
import '@webcomponents/scoped-custom-element-registry/scoped-custom-element-registry.min.js';
import { html } from 'lit';
import { themes, updateTheme } from '../../.storybook/themes';
import MockDate from 'mockdate';

// Id's of components that only need to be rendered once, not in all mock states.
const singleState = [
Expand All @@ -18,6 +19,10 @@ const singleState = [
'all--tooltip'
];

if (!import.meta.env?.DEV) {
MockDate.set('2025-06-01T00:00:00Z');
}

const preview: Preview = {
decorators: [
(story, { globals: { mode = 'light', theme = 'sanoma-learning' } }) => {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@
"husky": "^9.1.7",
"lint-staged": "^16.2.5",
"lit": "^3.3.1",
"mockdate": "^3.0.5",
"playwright": "^1.56.1",
"sinon": "^21.0.0",
"sinon-chai": "^4.0.1",
Expand Down
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5093,6 +5093,7 @@ __metadata:
husky: "npm:^9.1.7"
lint-staged: "npm:^16.2.5"
lit: "npm:^3.3.1"
mockdate: "npm:^3.0.5"
playwright: "npm:^1.56.1"
sinon: "npm:^21.0.0"
sinon-chai: "npm:^4.0.1"
Expand Down Expand Up @@ -16526,6 +16527,13 @@ __metadata:
languageName: node
linkType: hard

"mockdate@npm:^3.0.5":
version: 3.0.5
resolution: "mockdate@npm:3.0.5"
checksum: 10c0/36ab00c4b94d3e3cc8b9ecec27730dcf396d47d2ba046ad96635e7f9bc4bba0fff6125dedaba7313b1cadc0cefc0eb3f3ac0d5c3655707afd3b82fa4550aae92
languageName: node
linkType: hard

"moo@npm:^0.5.2":
version: 0.5.2
resolution: "moo@npm:0.5.2"
Expand Down