You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Default props from the "inner component" are not applied to memo'd component. The second test fails with <div>NaN</div>
importReactfrom'react';import{shallow}from'enzyme';constAdd=({ a, b })=><div>{a+b}</div>;Add.defaultProps={a: 2,b: 3,};constMemoAdd=React.memo(Add);describe('Enzyme Shallow Default Props Test',()=>{it('default props should be applied to components',()=>{constwrapper=shallow(<Add/>);expect(wrapper.html()).toEqual('<div>5</div>');});it('default props should be applied to memo components',()=>{constwrapper=shallow(<MemoAdd/>);expect(wrapper.html()).toEqual('<div>5</div>');});});
Expected behavior
Default props should be applied to the memo component
Your environment
API
shallow
mount
render
Version
library
version
enzyme
3.9.0
react
16.8.6
react-dom
16.8.6
react-test-renderer
16.8.6
adapter (below)
Adapter
enzyme-adapter-react-16
others ( )
The text was updated successfully, but these errors were encountered:
- [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`
Current behavior
Default props from the "inner component" are not applied to memo'd component. The second test fails with
<div>NaN</div>
Expected behavior
Default props should be applied to the memo component
Your environment
API
Version
Adapter
The text was updated successfully, but these errors were encountered: