title: Mock function is not called in click event while testing with jest and enzyme
body: <p>I am trying to test a redux connected react component, namely Cart, and I cannot get the below test to work. I want to see if an action is called inside a click handler for a button (imported from the material-ui package). </p>
  
  <p>The action is mapped to props via mapDispatchToProps.</p>
  
  <pre><code>const mapDispatchToProps = dispatch =&gt;
    bindActionCreators(SelectItemGalleryActions, dispatch);
  </code></pre>
  
  <p>I am also using </p>
  
  <pre><code>import configureStore from 'redux-mock-store';
  </code></pre>
  
  <p>to pass the mock store to my component in test.</p>
  
  <p>The handler is called but the spy is not recording that it has been called. I have tried most solutions I have found here or on github (shallow, simulate, dives, using jest.fn() instead of spy() ...); do you have any ideas? I am assuming that a different reference to the mock function I am trying to test is called.</p>
  
  <p><strong>First I am passing a mock store and an action</strong></p>
  
  <pre><code>const props = {
    store: mockStore({ selectItemGallery: { cartItems: [{ name: 'one' }] } }),
    removeAllItemsFromCartAction: spy()
  };
  const wrapper = mount(&lt;Cart {...props} /&gt;);
  </code></pre>
  
  <p><strong>After that I search for my button and simulate clicks on it</strong></p>
  
  <pre><code>const button = wrapper.find(Button).at(0);
  button.prop('onClick')('test1');
  button.prop('onClick')('test2');
  </code></pre>
  
  <p>The clicks work when I run the test. I get console.log() outputs from inside the handler. </p>
  
  <p><strong>Expectations</strong></p>
  
  <pre><code>expect(props.removeAllItemsFromCartAction.called).toBe(true);
  </code></pre>
  
  <p>However it is not called.</p>
  
  <p><strong>Here is the actual handler</strong></p>
  
  <pre><code> &lt;Button
      color="primary"
      onClick={x =&gt; {
        console.log(`onClick called on component with info ${x}`);
        removeAllItemsFromCartAction();
        console.log('removeAllItemsFromCartAction call is above me');
      }}&gt;    
          {t('Clear All')}
   &lt;/Button&gt;
  </code></pre>
  
  <p><strong>The console displays</strong></p>
  
  <p><a href="https://i.stack.imgur.com/jecG7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jecG7.png" alt="console output for test"></a></p>
  
  <p>Any hints or ideas are welcome. Thanks.</p>
  
  <p>Versions:</p>
  
  <pre><code>"enzyme": "^3.8.0",
  "enzyme-adapter-react-16": "^1.7.1",
  "jest": "^23.6.0",
  "sinon": "^7.2.2",
  "react": "^16.8.2"
  </code></pre>