x-dash
x-dash copied to clipboard
investigate shallow rendering for snapshots
when we have components that depend on other components, we should ensure the dependency's snapshot changing doesn't affect the dependent. enzyme shallow rendering would solve this but make e.g. the teaser snapshots not particularly useful, because they're generated top level and most markup is generated by sub-components.
we could jest-mock all other @financial-times/x-
components when testing a component, replacing it with something that returns the JSX used to render it shallow-render style. this could be tricky because we don't know looking at a module what things it exports are components.
(hat tip to @pavelpichrt for noticing this)
As mentioned in #207 I think that if we're going to create sustainable components then it may be better to not couple them.
If we're going to encapsulate components effectively then it could be left to the implementer to provide the sub-components as arguments and your Storybook demos only render placeholders.
This may not always be practical, but it lessons the risks of boundaries between components being broken.