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

auto update wrappers behind a flag #1186

Closed
wants to merge 1 commit into from
Closed

Conversation

jwbay
Copy link
Contributor

@jwbay jwbay commented Sep 28, 2017

This restores the auto update feature introduced by #490 for v3, but behind a feature flag. mount now needs the same treatment to keep the tree in sync that shallow used to. Fixes #1175.

For what it's worth, since pre-v3 both shallow and mount essentially auto-updated by default, the only Enzyme tests that break without the flag checks are these two, which are fixable by asserting with deep equality if that's on the table.
https://github.com/airbnb/enzyme/blob/106b5d14c79a1dfc4d3ee13f87b13ffb609c5c4a/packages/enzyme-test-suite/test/ReactWrapper-spec.jsx#L3696-L3710

@koba04
Copy link
Contributor

koba04 commented Dec 30, 2017

This PR seems to be reasonable to me.


it('should have updated output after an asynchronous setState', (done) => {
const wrapper = mount(<Test />, { autoUpdate: true });
wrapper.find('.async-btn').simulate('click');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd prefer to avoid simulate; can this do .prop('onClick')() instead?

@@ -675,7 +683,7 @@ class ReactWrapper {
*/
parents(selector) {
const allParents = this.wrap(
this.single('parents', n => parentsOfNode(n, this[ROOT].getNodeInternal())),
this.single('parents', n => parentsOfNode(n, this[ROOT][NODE])),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it might be a bugfix that should go in separately from an autoUpdate option?

@ljharb
Copy link
Member

ljharb commented Aug 22, 2018

@jwbay are you no longer interested in continuing this?

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

Successfully merging this pull request may close these issues.

Restore wrapper auto-update behavior behind a feature flag?
3 participants