Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
17 changes: 17 additions & 0 deletions code/renderers/react/src/csf-factories.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -384,3 +384,20 @@ describe('Composed getters', () => {
expect(renderSpy).toHaveBeenCalled();
});
});

it('meta.input also contains play', () => {
const meta = preview.meta({
/** Title, component, etc... */
play: async ({ canvas }) => {
/** Do some common interactions */
},
});

const ExtendedInteractionsStory = meta.story({
play: async ({ canvas, ...rest }) => {
await meta.input.play?.({ canvas, ...rest });

/** Do some extra interactions */
},
});
});
14 changes: 13 additions & 1 deletion code/renderers/react/src/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,19 @@ export interface ReactPreview<T extends AddonTypes> extends Preview<ReactTypes &
TArgs & Simplify<RemoveIndexSignature<DecoratorsArgs<ReactTypes & T, Decorators>>>
>;
},
{ args: Partial<TArgs> extends TMetaArgs ? {} : TMetaArgs }
Omit<
ComponentAnnotations<
ReactTypes &
T & {
args: Simplify<
TArgs & Simplify<RemoveIndexSignature<DecoratorsArgs<ReactTypes & T, Decorators>>>
>;
}
>,
'args'
> & {
args: Partial<TArgs> extends TMetaArgs ? {} : TMetaArgs;
}
>;
}

Expand Down
Loading