title: Test React Form internal submit
body: <p>I have this component:</p>
  <pre><code>function Form() {
    const [value, setValue] = useState('');
    const hanleSubmit = (ev) =&gt; {
      ev.preventDefault();
      console.log('submit', value);
    }
    return (
      &lt;form onSubmit={props.onSubmit}&gt;
        &lt;input type=&quot;text&quot; value={value} onChange={e =&gt; setValue(e.target.value)} /&gt;
        &lt;button type=&quot;submit&quot;&gt;Add&lt;/button&gt;
      &lt;/form&gt;
    );
  }
  </code></pre>
  <p>and the following test:</p>
  <pre><code>import React from &quot;react&quot;;
  import { render, fireEvent } from &quot;react-testing-library&quot;;
  import Form from &quot;./Form&quot;;
  
  it(&quot;submits&quot;, () =&gt; {
    const onSubmit = jest.fn();
    const { getByText } = render(&lt;Form /&gt;);
    fireEvent.click(getByText(&quot;Add&quot;));
    expect(onSubmit).toHaveBeenCalled(); // test fail with 0 called
  });
  </code></pre>
  <p>I know I gotta to pass this mock function as prop.</p>
  <p>But I'd like to know if exist a way to test internal function like <code>handleSubmit</code> without pass as prop?</p>
  <p>I'm using react-testing-library.</p>