Answer the question
In order to leave comments, you need to log in
How to search jest class if there are spaces?
don't find if the class el.props.className === "task-item__tools_Pin " with a space
and you can't check the string for indexOf
className={`task-item__tools_Pin ${this.props.data.pin === true ? "active" : ""}`}
I would like to find a solution so as not to go into the code and not remember what it won’t find with spaces or if it doesn’t find it for a class 2 component either
test('TaskItem-test task-item__tools_Pin', () => {
const btnPin = component.root.findAll((el) => {
console.log(el.props);
return el.props.className === "task-item__tools_Pin";
});
console.log(btnPin);
btnPin.onClick();
setPin.toHaveBeenCalled();
});
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