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
Function Components with React.memo(Component, areEquals) fails when I want to assert that a re-render didn't happen. When using Class Components that bug doesn't happen.
Expected behavior
Function Components with React.memo(Component, areEquals) should not fail when asserting a scenario where a re-render didn't happen.
functionDumbMemo({ number }){return<span>It's number {number}</span>;}functionareEqual(props,nextProps){// this function isn't covered by Enzyme, so the test fails:returnnextProps.number>10&&nextProps.number<20;}exportdefaultReact.memo(DumbMemo,areEqual);
it("<DumbMemo /> - should only re-render when number is between 10 and 20",()=>{// shallow or mount, both have the same bugconsttree=shallow(<DumbMemonumber={5}/>);expect(tree.text()).toBe("It's number 5");tree.setProps({number: 15});// BUG: It should pass, but it fails returning "It's number 15"expect(tree.text()).toBe("It's number 5");});
The text was updated successfully, but these errors were encountered:
sandrina-p
changed the title
Support React.memo() 2nd arg areEquals
False Negative: Missing support to React.memo 2nd arg "areEquals"
May 21, 2019
sandrina-p
changed the title
False Negative: Missing support to React.memo 2nd arg "areEquals"
False Negative: Add support to React.memo 2nd arg "areEquals"
May 21, 2019
Current behavior
Function Components with
React.memo(Component, areEquals)
fails when I want to assert that a re-render didn't happen. When using Class Components that bug doesn't happen.Expected behavior
Function Components with
React.memo(Component, areEquals)
should not fail when asserting a scenario where a re-render didn't happen.See Demo at CodeSandbox.
Your environment
API
Version
Adapter
The text was updated successfully, but these errors were encountered: