You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just an idea I had which is I believe the minimal I need in order to be to test some functionality with refs while still being able to use shallow rendering.
describe('refMockBuilder',()=>{it('calls it for each ref with the a wrapper for the element',()=>{constSimpleComponent=React.createClass({focus(){this.textInput.focus();},render(){return(<div><inputid='name'type='text'ref={(node)=>{this.textInput=node;}}/><buttononClick={this.focus}></button></div>);}});mocks={}constrefMockBuilder=(wrapper)=>{returnmocks[wrapper.props().id]={focus: sinon.stub()}}constwrapper=shallow(<SimpleComponent/>,{ refMockBuilder });wrapper.find('button').simulate('click')expect(mocks['name'].focus).to.have.been.called});});
I'm happy to try and implement this if you like the idea.
The text was updated successfully, but these errors were encountered:
Just an idea I had which is I believe the minimal I need in order to be to test some functionality with refs while still being able to use shallow rendering.
I'm happy to try and implement this if you like the idea.
The text was updated successfully, but these errors were encountered: