title: Test simulating form input in React with Jest
body: <p>I'm testing out the form input of a React component with Jest but I'm having trouble finding the best way to select the form's input field for entry using React TestUtils. The documentation online shows an example using <code>refs</code>, but the React docs also state that <code>refs</code> should only be used on the parent and not the children of the component. Should I be attaching <code>refs</code> to each input field or is there a better way to traverse the DOM and select the particular element so I can simulate a click event on it?</p>
  
  <p>This is my render</p>
  
  <pre><code>render (
      &lt;form className="products"&gt;
        &lt;input onChange={this.handleName} name="name" type="text" /&gt;
        &lt;input onChange={this.hanndleAge} name="age" type="text" /&gt;
      &lt;/form&gt;
  )
  </code></pre>
  
  <p>and my test</p>
  
  <pre><code>it('Should parse input fields', () =&gt; {
     Product = TestUtils.renderIntoDocument(&lt;ProductComponent /&gt;);
  
     // This returns all the inputs but how do tell them apart? 
     let inputs = TestUtils.scryRenderedDOMComponentsWithTag(Product, 'input');
  });
  </code></pre>