-
-
Notifications
You must be signed in to change notification settings - Fork 2k
dive() breaks when using the new context API. #1647
Copy link
Copy link
Closed
Description
Describe the bug
The new React context elements (https://reactjs.org/docs/context.html) report their type as objects instead of functions (custom react components) or strings (native react components), which breaks dive(). I haven't tested whether other methods of ShallowWrapper break.
To Reproduce
https://codesandbox.io/s/zxj4898zxp?module=%2Fsrc%2FApp.test.js
Expected behavior
shallow and dive should implement actual render semantics when handling the new context API:
- Automatically update current context whenever a context provider is encountered and remove the provider node from the tree.
- Automatically pass the current context to childs of context consumer nodes and remove the consumer node from the tree.
I'm sure the above are not the exact semantics, but at least the most intuitive.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels