Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

investigate shallow rendering for snapshots #199

Open
apaleslimghost opened this issue Oct 10, 2018 · 1 comment
Open

investigate shallow rendering for snapshots #199

apaleslimghost opened this issue Oct 10, 2018 · 1 comment
Labels
enhancement New feature or request housekeeping Cleaning things up

Comments

@apaleslimghost
Copy link
Member

apaleslimghost commented Oct 10, 2018

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)

@apaleslimghost apaleslimghost added enhancement New feature or request housekeeping Cleaning things up labels Oct 10, 2018
@i-like-robots
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request housekeeping Cleaning things up
Projects
None yet
Development

No branches or pull requests

2 participants