Freeze ROOT_NODES for child wrappers#1811
Merged
ljharb merged 3 commits intoenzymejs:fix_find_statefulnessfrom Sep 21, 2018
Merged
Freeze ROOT_NODES for child wrappers#1811ljharb merged 3 commits intoenzymejs:fix_find_statefulnessfrom
ljharb merged 3 commits intoenzymejs:fix_find_statefulnessfrom
Conversation
Collaborator
Author
|
@ljharb how to rerun tests if they seem flaky? |
Member
|
@jgzuke you should be able to click through to the job and rerun the specific builds that errored; i've just done it for this one. |
616c80c to
610cc44
Compare
Collaborator
Author
ljharb
reviewed
Sep 12, 2018
e792c97 to
4dd2780
Compare
a291614 to
53be3e8
Compare
ljharb
added a commit
that referenced
this pull request
Oct 5, 2018
- [new] `mount`: `.state()`/`.setState()`: allow calling on children (#1802) - [new] `configuration`: add `reset` - [fix] `makeOptions`: ensure that config-level `attachTo`/`hydrateIn` are inherited into wrapper options (#1836) - [fix] `shallow`/`Utils`: call into adapter’s `isCustomComponentElement` if present (#1832) - [fix] `shallow`/`mount`: throw an explicit error when state is null/undefined - [fix] freeze ROOT_NODES for child wrappers (#1811) - [fix] `shallow`: `.parents`: ensure that one `.find` call does not affect another (#1781) - [fix] `mount`: update after `simulateError` (#1812) - [refactor] `mount`/`shallow`: `getElement`: use `this.single` - [deps] update `babel-preset-airbnb`, `chai`, `eslint`, `mocha`, `enzyme-adapter-utils`, `react-is`, `airbnb-js-shims`
This was referenced Oct 5, 2018
13 tasks
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.
Fixes the tests in #1781.
There are a few alternative ways to do fix those tests (and some things wrong with this one)
Solution 1 - This one! Save the original
ROOTnode tree, and use in calls toparentsetcROOTnode tree after rootupdate.updates will affect theROOTnode tree but not the saved tree. This is already sort of the case, currently updates to theROOT(for example setting state) would not affectchildWrapper[NODES], but would modifychildWrapper[ROOT][NODES]. Given that we want child wrappers to be immutable I think this might make the most sense..root().getNodeInternal()instead ofgetRootNodeInternal()Solution 2 - On
updatewe swap all child wrappersROOTs to a copy of the old root.Solution 3 - Make child wrappers not able to cause
updatesSolution 4 - Make child wrappers not immutable and update with component updates
@ljharb