title: react jest unit testing children components with events
body: <p>if I have a child component that has an onclick event, which in turn calls the parent event handler, what is the best way to unit test this? In my case, the text value of the button changes when the user clicks on it - this is handled in this.props.myEvent.</p>
  
  <p>My unit test works when testing the initial value </p>
  
  <pre><code>expect(button.getDOMNode().textContent).toEqual('startValue');
  </code></pre>
  
  <p>, but how do i create the unit test for when user clicks the button and the button value is updated to a certain value?</p>
  
  <p>In my case I have a button:</p>
  
  <pre><code>var React  = require('react');
  
  module.exports = React.createClass({
    myEvent: function(a,b){
      this.props.myEvent(a, b);
    },
    render: function() {
      return (
          &lt;button name="myButton" id={this.props.id} onClick={this.myEvent.bind(this.props.a,this.props.b)}&gt;{this.props.value}&lt;/button&gt;
      )
    }
  });
  </code></pre>
  
  <p>thanks</p>