-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add support for react context element types, fixes #1509 #1513
Changes from 5 commits
e21b7b5
9d01e42
81167fb
419780b
f3618c1
9fb423e
5253067
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,9 @@ const FunctionalComponent = 1; | |
const HostPortal = 4; | ||
const HostComponent = 5; | ||
const HostText = 6; | ||
const Mode = 11; | ||
const ContextConsumer = 12; | ||
const ContextProvider = 13; | ||
|
||
function nodeAndSiblingsArray(nodeWithSibling) { | ||
const array = []; | ||
|
@@ -82,8 +85,6 @@ function toTree(vnode) { | |
instance: node.stateNode, | ||
rendered: childrenToTree(node.child), | ||
}; | ||
case Fragment: // 10 | ||
return childrenToTree(node.child); | ||
case FunctionalComponent: // 1 | ||
return { | ||
nodeType: 'function', | ||
|
@@ -111,6 +112,11 @@ function toTree(vnode) { | |
} | ||
case HostText: // 6 | ||
return node.memoizedProps; | ||
case Fragment: // 10 | ||
case Mode: // 11 | ||
case ContextProvider: // 13 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. O.o ContextProvider and ContextConsumer are new node types, they're not just components? |
||
case ContextConsumer: // 12 | ||
return childrenToTree(node.child); | ||
default: | ||
throw new Error(`Enzyme Internal Error: unknown node with tag ${node.tag}`); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,4 +49,4 @@ | |
"eslint-plugin-jsx-a11y": "^6.0.3", | ||
"eslint-plugin-react": "^7.6.1" | ||
} | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please ensure all files always have a trailing newline There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please revert this; all files should have a trailing newline There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry i'm not sure why my editor keeps doing this, it otherwise is set to add trailing nls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^16.0.0-0
only handles prerelease ranges the exact version16.0.0
not any prerelease of any version of16