title: Jest mocking with react calling actual event handler after calling mock function
body: <p>I have this component test </p>
  
  <pre><code>    const component = mount(&lt;MemoryRouter&gt;&lt;Login/&gt;&lt;/MemoryRouter&gt;);
      const emailField = component.find('input[type="email"]');
      const passwordField = component.find('input[type="password"]');
      const mockedSubmitFunction=jest.fn();
      component.find(Login).instance().onSubmit=mockedSubmitFunction;
      emailField.simulate('change', { target: { value: testEmail } });
      passwordField.simulate('change', { target: { value: testPassword } });
      component.find('form').simulate('submit');
      expect(mockedSubmitFunction).toBeCalled();
  </code></pre>
  
  <p>and in the component i have</p>
  
  <p>in constructor :- </p>
  
  <pre><code>this.onSubmit = this.onSubmit.bind(this);
  </code></pre>
  
  <p>and the eventhandler </p>
  
  <pre><code>   onSubmit(event) {
     event.preventDefault(); 
  </code></pre>
  
  <p>when i put a breakpoint in onSubmit it is coming to the component function after executing the mocked onSubmit, why is this happening.</p>
  
  <p>I assumed it will only call the mocked onSubmit.</p>
  
  <p>What am I doing differently?</p>
  
  <p>CodeSandbox :<a href="https://codesandbox.io/s/q95lv7vlrw" rel="nofollow noreferrer">https://codesandbox.io/s/q95lv7vlrw</a></p>
  
  <p>But the sandbox is showing Could not find module in path: 'object-inspect/util.inspect' relative to '/node_modules/object-inspect/index.js' for some reason, which is unrelated i guess</p>