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

Fix shallow renderer callbacks #10106

Merged
merged 4 commits into from Jul 10, 2017
Merged

Fix shallow renderer callbacks #10106

merged 4 commits into from Jul 10, 2017

Conversation

ghost
Copy link

@ghost ghost commented Jul 4, 2017

Shallow renderer now executes any callbacks passed to setState/replaceState/forceUpdate.

Fixes #10089
I've incorporated failing tests provided in #10092 by @Leeds-eBooks.

@ghost ghost changed the title Patch shallow test renderer setstate callback Fix shallow renderer callbacks Jul 4, 2017
Copy link
Contributor

@bvaughn bvaughn left a comment

Choose a reason for hiding this comment

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

Thank you @codepodu and @Leeds-eBooks for this work!


// No longer a public API, but we can test that it works internally by
// reaching into the updater.
shallowRenderer._updater.enqueueReplaceState(
Copy link
Contributor

Choose a reason for hiding this comment

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

Wish we had a better way to test this~ but there's precedent in at least a half dozen other tests so it's probably okay. 😁

@bvaughn
Copy link
Contributor

bvaughn commented Nov 15, 2017

It was merged on July 10th, which was in between the last 16 alpha release and the first beta release I think. Not that you'd be interested in installing either. This fix is in all of the 16.x final releases though.

@mabounassif
Copy link

It's not working for me - setState callback is not being called. Very similar to the following issue: enzymejs/enzyme#953.

Using

"react": "^16.1.1"
"enzyme": "^3.1.1"

Will investigate more and try to pinpoint the issue

@bvaughn
Copy link
Contributor

bvaughn commented Nov 15, 2017

Open a new issue with repro steps if you're convinced it's still an issue. 😄

PR #10106 did add tests for this though, FWIW.

@mabounassif
Copy link

The library I'm depending on is still pointing to the older version of react-test-renderer.
https://github.com/airbnb/enzyme/blob/master/packages/enzyme-adapter-react-16/package.json#L42

All is good. Sorry about the false alarm.

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.

4 participants