You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When reusing Stories in test files, I want to extend them to add decorators and render the resulting React Component.
However the .Component prop does not exist on Stories created by .extend.
Describe the solution you'd like
import*asstoriesfrom'./MyComponent.stories';constTestStory=stories.StoryComponent.extend({decorators: [...testingSpecificDecorators]...)}it('tests something',()=>{render(<TestStory.Component/>);// Component prop doesn't exist here
....})
Describe alternatives you've considered
There is a way to achieve what I want by creating a new story from the extended component which feels akward and requires exporting meta from the Storybook file:
import*asstoriesfrom'./MyComponent.stories';constTestStoryExtended=stories.StoryComponent.extend({decorators: [...testingSpecificDecorators]...)}constTestStory=stories.meta.story({
....TestStoryExtended.composed,
....TestStoryExtended.input})it('tests something',()=>{render(<TestStory.Component/>);// works as expected
....})
Are you able to assist to bring the feature to reality?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
When reusing Stories in test files, I want to extend them to add decorators and render the resulting React Component.
However the
.Component
prop does not exist on Stories created by.extend
.Describe the solution you'd like
Describe alternatives you've considered
There is a way to achieve what I want by creating a new story from the extended component which feels akward and requires exporting meta from the Storybook file:
Are you able to assist to bring the feature to reality?
no
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions