diff --git a/examples/official-storybook/stories/core/decorators.stories.js b/examples/official-storybook/stories/core/decorators.stories.js new file mode 100644 index 000000000000..2edb62f9d66f --- /dev/null +++ b/examples/official-storybook/stories/core/decorators.stories.js @@ -0,0 +1,39 @@ +import React from 'react'; + +// We would need to add this in config.js idomatically however that would make this file a bit confusing +import { addDecorator } from '@storybook/react'; + +addDecorator((s, { kind }) => + kind === 'Core|Decorators' ? ( + <> +
Global Decorator
+ {s()} + > + ) : ( + s() + ) +); + +export default { + title: 'Core|Decorators', + decorators: [ + s => ( + <> +Kind Decorator
+ {s()} + > + ), + ], +}; + +export const all = () =>Story
; +all.parameters = { + decorators: [ + s => ( + <> +Local Decorator
+ {s()} + > + ), + ], +}; diff --git a/examples/official-storybook/tests/__snapshots__/storyshots.test.js.snap b/examples/official-storybook/tests/__snapshots__/storyshots.test.js.snap index 7762dadd29e3..02e967122729 100644 --- a/examples/official-storybook/tests/__snapshots__/storyshots.test.js.snap +++ b/examples/official-storybook/tests/__snapshots__/storyshots.test.js.snap @@ -5077,6 +5077,23 @@ exports[`Storyshots Basics|ScrollArea vertical 1`] = ` `; +exports[`Storyshots Core|Decorators all 1`] = ` +Array [ ++ Global Decorator +
, ++ Kind Decorator +
, ++ Local Decorator +
, ++ Story +
, +] +`; + exports[`Storyshots Core|Events Force re-render 1`] = ` .emotion-0 { border: 0; diff --git a/lib/client-api/src/client_api.js b/lib/client-api/src/client_api.js index 4d011d6da79d..b9b7925fff8d 100644 --- a/lib/client-api/src/client_api.js +++ b/lib/client-api/src/client_api.js @@ -203,7 +203,12 @@ export default class ClientApi { }, { applyDecorators: this._decorateStory, - getDecorators: () => [...localDecorators, ..._globalDecorators, withSubscriptionTracking], + getDecorators: () => [ + ...(allParam.decorators || []), + ...localDecorators, + ..._globalDecorators, + withSubscriptionTracking, + ], } ); return api;