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

.dive() doesn't work well with component using useContext() #2165

Open
2 of 13 tasks
chenesan opened this issue Jun 14, 2019 · 2 comments
Open
2 of 13 tasks

.dive() doesn't work well with component using useContext() #2165

chenesan opened this issue Jun 14, 2019 · 2 comments

Comments

@chenesan
Copy link
Contributor

This issue is for closing #2011 and tracking the skipped shallow test.

Current behavior

See skipped shallow test in https://github.com/airbnb/enzyme/blob/master/packages/enzyme-test-suite/test/shared/hooks/useContext.jsx#L50-L54 . After .dive() call in the internal component the context value is still initialTitle in .shallow(), not the value from outer <Provider />.

Expected behavior

In that test the text value should be as same as value from outer <Provider />.

Your environment

API

  • shallow
  • mount
  • render

Version

library version
enzyme master branch
react 16.8.6
react-dom 16.8.6
react-test-renderer 16.8.6
adapter (below) master branch

Adapter

  • enzyme-adapter-react-16
  • enzyme-adapter-react-16.3
  • enzyme-adapter-react-16.2
  • enzyme-adapter-react-16.1
  • enzyme-adapter-react-15
  • enzyme-adapter-react-15.4
  • enzyme-adapter-react-14
  • enzyme-adapter-react-13
  • enzyme-adapter-react-helper
  • others ( )
@ljharb
Copy link
Member

ljharb commented Jun 14, 2019

This seems related to #2114, I suspect.

@atsikov
Copy link

atsikov commented Jun 21, 2019

Just for a note: most likely connect from react-redux doesn't work properly with shallow.dive because of this issue.
Some minimal repro: https://codesandbox.io/s/old-currying-4lme5 (which seems to be similar to the skipped test above)

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

No branches or pull requests

3 participants