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 simulate being a no-op for memo components #2100

Merged
merged 1 commit into from
Apr 23, 2019

Conversation

eps1lon
Copy link
Contributor

@eps1lon eps1lon commented Apr 16, 2019

Fixes mount(<MemoizedButton />).simulate('click') not calling the onClick handler.

I strongly suspect this fixes issues with simulate not necessarily related to React.memo as well.

Alternate implementation without arrow functions and outer this: 9ef0776

…l the adapter’s implementation, not the raw one
Copy link
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

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

Thanks! This change will need to be made in all the react 16 adapters; also, instead of the arrow function, this should use the adapter reference that's already available (i've made that tweak).

I've confirmed that the new test fails without the fix. This seems to be something I broke here: 8221765

@eps1lon
Copy link
Contributor Author

eps1lon commented Apr 23, 2019

@ljharb That's even better, thanks.

@eps1lon eps1lon deleted the fix/memo-props branch April 23, 2019 05:57
ljharb added a commit that referenced this pull request May 7, 2019
 - [fix] `simulateEvent`: call the adapter’s implementation, not the raw one (#2100)
 - [deps] update `enzyme-adapter-utils`
 - [dev deps] update `eslint-plugin-react`, `eslint-plugin-import`
ljharb added a commit that referenced this pull request May 8, 2019
 - [fix] `simulateEvent`: call the adapter’s implementation, not the raw one (#2100)
 - [deps] update `enzyme-adapter-utils`
 - [dev deps] update `eslint-plugin-react`, `eslint-plugin-import`
ljharb added a commit that referenced this pull request May 12, 2019
 - [new] support `suspenseFallback` option; support `Suspense`/`Lazy` (#1975)
 - [fix] `shallow`: properly dive through `memo` components (#2103, #2068)
 - [fix] avoid a Context.Provider deprecation warning
 - [fix] shallow renderer for `memo` does not respect `defaultProps` (#2115)
 - [fix] Don’t show wrapped component displayName in lazy component (#1975)
 - [fix] `simulateEvent`: call the adapter’s implementation, not the raw one (#2100)
 - [deps] update `enzyme-adapter-utils`
 - [dev deps] update `eslint-plugin-react`, `eslint-plugin-import`
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.

2 participants