[List, Edit, Create, Show] Wrap view components into styles HOC instead of wrapping main components - #3161
Conversation
|
You're totally right, it makes more sense. Would you mind doing the same for Edit and List, so that all views are consistent? |
| }; | ||
|
|
||
| export default withStyles(styles)(Show); | ||
| export default Show; |
There was a problem hiding this comment.
It does not make much sense to have both a named and a default export for the same object. Remove the named export (you will have to change the import in Show.spec.js, too).
|
Did the same for |
|
@fzaninotto I've managed to fix that by using Generally, I'm not a big fan of enzyme unit tests. They are tightly coupled with implementation details, which leads to false positives like this one. |
|
Awesome, thanks! |
When using
ShowControllerandShowViewinstead of singleShowcomponent,Showstyles aren't used anymore.This makes
asidecomponent appear under show view (when usingShowcomponent,asideis on the right).Wrapping
ShowViewwith styles HOC resolves the issue. Also, it makes more sense, since styles are related to view component, notShowcomponent, which is simply composition of controller and view.