Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('After running the LOAD_IMAGE command, existing objects should not include cropzone.', done => {
const objCropzone = new fabric.Object({type: 'cropzone'});
invoker.execute(commands.ADD_OBJECT, graphics, objCropzone).then(() => {
invoker.execute(commands.LOAD_IMAGE, graphics, 'image', imageURL).then(() => {
const lastUndoIndex = invoker._undoStack.length - 1;
const savedObjects = invoker._undoStack[lastUndoIndex].undoData.objects;
expect(savedObjects.length).toBe(0);
done();
});
});
});
it('`evented` attribute of the saved object must be true after LOAD_IMAGE.', done => {
const objCircle = new fabric.Object({
type: 'circle',
evented: false
});
invoker.execute(commands.ADD_OBJECT, graphics, objCircle).then(() => {
invoker.execute(commands.LOAD_IMAGE, graphics, 'image', imageURL).then(() => {
const lastUndoIndex = invoker._undoStack.length - 1;
const [savedObject] = invoker._undoStack[lastUndoIndex].undoData.objects;
expect(savedObject.evented).toBe(true);
done();
});
});
});
it('add() should create the arrow icon when parameter value is "arrow".', () => {
const path = icon._pathMap.arrow;
spyOn(icon, '_createIcon').and.returnValue(new fabric.Object({}));
icon.add('arrow');
expect(icon._createIcon).toHaveBeenCalledWith(path);
});
beforeEach(() => {
object = new fabric.Object();
object2 = new fabric.Object();
group = new fabric.Group();
graphics.add(object);
graphics.add(object2);
graphics.add(group);
group.add(object, object2);
});
beforeEach(() => {
obj = new fabric.Object();
});
beforeEach(() => {
object = new fabric.Object();
object2 = new fabric.Object();
group = new fabric.Group();
graphics.add(object);
graphics.add(object2);
graphics.add(group);
group.add(object, object2);
});