Answer the question
In order to leave comments, you need to log in
How to write unit tests for fabricjs on jasmine?
Hello.
There is a project to write using the fabric js library, and accordingly you need to test it. Well, the problem is that most of the functions there contain the canvas.getActiveObject() line, and I don’t understand if it’s possible to emulate object clicks in jasmine?
Here is an example at plnkr.co/edit/V8yh08FtJy4qaQMc87qE?p=preview
There is a button on which the fontBold() function is hung in it code
var obj = canvas.getActiveObject();
if (!obj) return;
obj.fontWeight = (obj.fontWeight === 'bold') ? 'normal' : 'bold';
canvas.renderAll();
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