title: Testing Select element in a react application
body: <p>I want to write a test that will check when I change the value of a select element in my react application.</p>
  <pre><code>import React, { Component } from 'react';
  
  const TimeList =(props) =&gt;{
  
  
  
  return(
      &lt;div&gt;
      &lt;label&gt;
        Time
        &lt;br/&gt;
        &lt;select name=&quot;lessonTime&quot; value={props.defaultTime} onChange={props.handleChange}&gt;
          &lt;option value=&quot;8:00&quot;&gt;8:00&lt;/option&gt;
          &lt;option value=&quot;8:30&quot;&gt;8:30&lt;/option&gt;
          &lt;option value=&quot;9:00&quot;&gt;9:00&lt;/option&gt;
          &lt;option value=&quot;10:00&quot;&gt;10:00&lt;/option&gt;
          &lt;option value=&quot;12:00&quot;&gt;12:00&lt;/option&gt;
          &lt;option value=&quot;13:30&quot;&gt;13:30&lt;/option&gt;
          &lt;option value=&quot;19:00&quot;&gt;19:00&lt;/option&gt;
          &lt;option value=&quot;19:30&quot;&gt;19:30&lt;/option&gt;
        &lt;/select&gt;
      &lt;/label&gt;
      &lt;/div&gt;
    );
  
  };
  
  export default TimeList;
  </code></pre>
  <p>My Test code:</p>
  <pre><code>it('should select correct time',() =&gt;{
      const mockFunc = jest.fn();
      const wrapper = mount(&lt;TimeList value='10:00'
      onChange={mockFunc}/&gt;)
      console.log(wrapper.props());
      wrapper.find('select').simulate('change',{target:{value:'8:00'}});
      expect(wrapper.find('select').props().value).toBe('8:00');
    });
  </code></pre>
  <p>The error Im getting is:</p>
  <pre><code> Expected value to be (using ===):
        &quot;8:00&quot;
      Received:
        undefined
      
      Difference:
      
        Comparing two different types of values. Expected string but received undefined.
  </code></pre>
  <p>It seems I haven't understood how to test the select element.</p>
  <p>Any ideas on how to create this kind of test?</p>