Skip to content
Closed
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
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 */
},
});
Comment on lines +396 to +402
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused variable ExtendedInteractionsStory.

Suggested change
const ExtendedInteractionsStory = meta.story({
play: async ({ canvas, ...rest }) => {
await meta.input.play?.({ canvas, ...rest });
/** Do some extra interactions */
},
});

Copilot uses AI. Check for mistakes.
});
Comment on lines +388 to +403
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test verifies that meta.input.play is properly typed but doesn't actually verify that the play function is callable or has the correct behavior at runtime. Consider adding a runtime assertion to verify that meta.input.play is actually defined and callable. For example, you could add expect(meta.input.play).toBeDefined(); or use a spy to verify the play function is called when invoked.

Copilot uses AI. Check for mistakes.
14 changes: 13 additions & 1 deletion code/renderers/react/src/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,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