Answer the question
In order to leave comments, you need to log in
Why jest and enzyme don't see ref in component?
this is how i add the ref
setinputTaskItemName = (ref) => {
this.inputTaskItemName = ref;
};
<input type="text" className="task-item-name" name="title" placeholder="Enter task item name" required="" ref={this.setinputTaskItemName} />
it('should render Input', () => {
expect(component.find(".task-item-name").at(0)).toHaveLength(1);
expect(component.instance().inputTaskItemName).toBeTruthy();
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question