Add children to mounted portal props#1774
Merged
ljharb merged 1 commit intoenzymejs:masterfrom Aug 20, 2018
Merged
Conversation
1606438 to
422dd30
Compare
ljharb
reviewed
Aug 19, 2018
| containerInfo: containerDiv, | ||
| }, | ||
| key: undefined, | ||
| ref: undefined, |
Member
There was a problem hiding this comment.
based on your comment, it seems like this should be null, and not undefined. Thoughts?
Collaborator
Author
There was a problem hiding this comment.
Yep, does it make sense that portal rendered.ref should always be null? Im not sure what refs are here. I will follow up on the other issue (array wrapping rendered in shallow) as well but separately.
Member
There was a problem hiding this comment.
Does ref ever return undefined for anything else? If not, then it should probably be null here.
422dd30 to
0f0f052
Compare
ljharb
approved these changes
Aug 20, 2018
ljharb
added a commit
that referenced
this pull request
Aug 25, 2018
- [New] Add Portal support (#1760, #1761, #1772, #1774, @jgzuke) - [New] Add pointer events support (#1753, @ljharb) - [New] Add `displayNameOfNode`, `isValidElementType` (#1701, @jquense) - [New] pass the adapter into `createMountWrapper` (#1592, @jquense) - [Fix] `shallow`: skip updates when nextState is `null` or `undefined` (#1785, @koba04) - update deps - [meta] ensure a license and readme is present in all packages when published
ljharb
added a commit
that referenced
this pull request
Aug 25, 2018
- [New] Add forwardRef support (#1592, @jquense) - [New] Add Portal support (#1760, #1761, #1772, #1774, @jgzuke) - [New] Add pointer events support (#1753, @ljharb) - [New] Add `displayNameOfNode`, `isValidElementType` (#1701, @jquense) - [New] pass the adapter into `createMountWrapper` (#1592, @jquense) - [Fix] preemptively fix compat with React v16.4.3 (#1790, #1778, @gaearon, @aweary) - [Fix] `shallow`: skip updates when nextState is `null` or `undefined` (#1785, @koba04) - update deps - [meta] ensure a license and readme is present in all packages when published
ljharb
added a commit
that referenced
this pull request
Aug 25, 2018
- [New] Add forwardRef support (#1592, @jquense) - [New] Add Portal support (#1760, #1761, #1772, #1774, @jgzuke) - [New] Add pointer events support (#1753, @ljharb) - [Fix] preemptively fix compat with React v16.4.3 (#1790, #1778, @gaearon, @aweary) - [Fix] `shallow`: prevent rerenders with PureComponents (#1786, @koba04) - [Fix] `shallow`: skip updates when nextState is `null` or `undefined` (#1785, @koba04) - [Fix] `shallow`: `setState` after `setProps` calls `componentWillReceiveProps` (#1779, @peanutenthusiast) - [Fix] `mount`/`shallow`: be stricter on the wrapper’s setState/setProps callback - [Fix] `shallow`/`mount`: improve error message when wrapping invalid elements (#1759, @jgzuke) - update deps - [Refactor] remove most uses of lodash - [meta] ensure a license and readme is present in all packages when published
This was referenced Aug 25, 2018
This was referenced Oct 1, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add
childrento mounted portalprops. This brings the mount results in line with the shallow results and the other element types (which haveprops.children).Also added the
shallow renders react portalstest. Compared to therenders react portalstest above,node.rendered.refcomes backundefinedinstead ofnullwhich may be an issue with https://github.com/airbnb/enzyme/blob/master/packages/enzyme-adapter-react-16/src/ReactSixteenAdapter.js#L103, if a portal can never have refs this might make sense to hard code asnull. The inner divsrenderedalso comes back'Hello World!'instead of['Hello World!']which seems like the shallow rendererUtils.elementToTreeis missing the check at https://github.com/airbnb/enzyme/blob/master/packages/enzyme-adapter-react-16/src/ReactSixteenAdapter.js#L157.