diff --git a/packages/storybook/stories/components/modal/modal.stories.ts b/packages/storybook/stories/components/modal/modal.stories.ts index f0f152805b..297206b099 100644 --- a/packages/storybook/stories/components/modal/modal.stories.ts +++ b/packages/storybook/stories/components/modal/modal.stories.ts @@ -1,3 +1,4 @@ + import type { Meta, StoryObj } from '@storybook/web-components'; import { defineCustomElement } from '@ovhcloud/ods-components/dist/components/ods-modal'; import { ODS_MODAL_COLOR, ODS_MODAL_COLORS } from '@ovhcloud/ods-components'; @@ -14,12 +15,25 @@ const meta: Meta = { export default meta; +const resetRoot = () => { + const storybookRoot = document.querySelector('#storybook-root'); + if (storybookRoot) { + storybookRoot.innerHTML = ''; + } +}; + +const withResetRoot = (storyFn: any) => { + resetRoot(); + return storyFn(); +}; + export const Demo: StoryObj = { render: (args) => html` ${unsafeHTML(args.content)} ${unsafeHTML(args.actions)} + @@ -91,6 +105,7 @@ export const Demo: StoryObj = { margin-top: 1rem; }` }, + decorators: [withResetRoot], }; export const Overview: StoryObj = { @@ -103,12 +118,14 @@ export const Overview: StoryObj = { -`, + `, + decorators: [withResetRoot], }; export const Default: StoryObj = { @@ -126,14 +144,16 @@ export const Default: StoryObj = { -`, + `, }; export const CustomCSS: StoryObj = { @@ -147,12 +167,14 @@ export const CustomCSS: StoryObj = { `, -}; \ No newline at end of file +};