diff --git a/.storybook/preview.ts b/.storybook/preview.ts index 97d234f1a42..4f0a7f1eabc 100644 --- a/.storybook/preview.ts +++ b/.storybook/preview.ts @@ -1,8 +1,13 @@ import * as tokens from '@sbb-esta/lyne-design-tokens'; +import type { StoryContext } from '@storybook/types'; +import type { Decorator } from '@storybook/web-components'; +import isChromatic from 'chromatic/isChromatic'; +import { html } from 'lit'; -import '../src/components/core/styles/global.scss'; import { withBackgroundDecorator } from '../src/storybook/testing/with-background-decorator.js'; +import '../src/components/core/styles/global.scss'; + const getViewportName = (key: string): string => key.replace(/(^SbbBreakpoint|Min$)/g, '').toLowerCase(); @@ -65,4 +70,10 @@ export const parameters = { }, }; -export const decorators = [withBackgroundDecorator]; +export const decorators: Decorator[] = [ + (story, context: StoryContext) => + isChromatic() && context.parameters.layout !== 'fullscreen' + ? html`
` + : story(), + withBackgroundDecorator, +]; diff --git a/src/components/autocomplete/autocomplete.stories.ts b/src/components/autocomplete/autocomplete.stories.ts index b146c48ff2c..d008f333778 100644 --- a/src/components/autocomplete/autocomplete.stories.ts +++ b/src/components/autocomplete/autocomplete.stories.ts @@ -504,7 +504,10 @@ export const MixedSingleOptionWithOptionGroupNegative: StoryObj = { }; const meta: Meta = { - decorators: [withActions as Decorator], + decorators: [ + (story) => (isChromatic() ? html`