Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

.addDecorator is probably not working #68

Closed
kitze opened this issue Dec 23, 2016 · 4 comments
Closed

.addDecorator is probably not working #68

kitze opened this issue Dec 23, 2016 · 4 comments

Comments

@kitze
Copy link

kitze commented Dec 23, 2016

I'm using material-ui in my project for some of the components. The components that are not affected by material-ui and don't need muiTheme pass the tests. But the other components that need muiTheme provided by context, are failing with a warning Warning: Failed context type: The context `muiTheme` is marked as required in `CircularProgress`, but its value is `undefined`.

Keep in mind that the stories in storybook are fine because I'm providing muiTheme through a decorator like this in my global .storybook/config.js file:

addDecorator(story => wrapWithStyles(story()));
addDecorator(story => wrapWithMui(story()));
@arunoda
Copy link
Contributor

arunoda commented Dec 24, 2016

@roonyh what do you think about this issue?

@roonyh
Copy link
Contributor

roonyh commented Dec 27, 2016

@kitze I am taking a look. addDecorator works with simple wrappers but I guess something does not work with context. Have you used storyshots 2.x versions successfully with your stories?

@fredantell
Copy link

I'm running into the same issue. I have a component I specifically created for testing. I can use a global addDecorator and it works fine with storybooks. Then when I run storyshot via jest it fails trying to find functions that should have been injected via context.

If I use addDecorator on a per story level it works fine in both storybooks and storyshots.
Similarly if I just wrap each story directly in the component that also works fine for both storybook and storyshots.

@jacobk
Copy link

jacobk commented Mar 24, 2017

I have this issue too with storyshots 3.2.2.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

6 participants