title: Why is my button undefined in my test?
body: <p>My test:</p>
  
  <pre><code>  describe('button component', () =&gt; {
      it('should toggle off when clicked', () =&gt; {
        let component;
        component = ReactTestUtils.renderIntoDocument(&lt;Search /&gt;);
        let searchbtn = ReactTestUtils.findRenderedDOMComponentWithTag(component, 'button');
        ReactTestUtils.Simulate.click(searchbtn);
        console.log(searchbtn, 'search button***'); //UNDEFINED
        expect(searchbtn.calledOnce).to.equal(false);
      })
    });
  </code></pre>
  
  <p>This is my search component:</p>
  
  <pre><code>  render() {
      return (
        &lt;div className="search"&gt;
          &lt;button className="searchButton" onClick={this.handleSearch}&gt;{this.state.on ? 'ON' : 'OFF'}&lt;/button&gt;
        &lt;/div&gt;
      );
    }
  </code></pre>
  
  <p>Do I need to spy on it or mock it? or is there a better way to test buttons in react?</p>