Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return cbRes.then(() => window.location.assign(reTo), () => window.location.assign(reTo));
else
window.location.assign(reTo);
} else {
window.location.assign(reTo);
}
// We should never get here because of the redirection above
return new Promise(() => {}); // Intentionally never resolve
} else {
if (callback) {
const cbRes = callback(loginResponse.userId, loginResponse.needsRedirect);
if (cbRes && cbRes.then)
return cbRes.then(() => loginResponse.userId);
}
return Promise.resolve(loginResponse.userId);
}
}
setAngle(angle) {
const oldAngle = this.getCurrentAngle() % 360; // The angle is lower than 2*PI(===360 degrees)
angle %= 360;
const canvasImage = this.getCanvasImage();
const oldImageCenter = canvasImage.getCenterPoint();
canvasImage.set({angle}).setCoords();
this.adjustCanvasDimension();
const newImageCenter = canvasImage.getCenterPoint();
this._rotateForEachObject(oldImageCenter, newImageCenter, angle - oldAngle);
return Promise.resolve(angle);
}
it('can register custom command', done => {
const testCommand = {
name: 'testCommand',
execute() {
},
undo() {
}
};
spyOn(testCommand, 'execute').and.returnValue(Promise.resolve('testCommand'));
spyOn(testCommand, 'undo').and.returnValue(Promise.resolve());
commandFactory.register(testCommand);
const command = commandFactory.create('testCommand');
expect(command).not.toBe(null);
invoker.execute('testCommand', graphics).then(commandName => {
expect(commandName).toBe('testCommand');
expect(testCommand.execute).toHaveBeenCalledWith(graphics);
done();
})['catch'](message => {
fail(message);
done();
});
});
it('can register custom command', done => {
const testCommand = {
name: 'testCommand',
execute() {
},
undo() {
}
};
spyOn(testCommand, 'execute').and.returnValue(Promise.resolve('testCommand'));
spyOn(testCommand, 'undo').and.returnValue(Promise.resolve());
commandFactory.register(testCommand);
const command = commandFactory.create('testCommand');
expect(command).not.toBe(null);
invoker.execute('testCommand', graphics).then(commandName => {
expect(commandName).toBe('testCommand');
expect(testCommand.execute).toHaveBeenCalledWith(graphics);
done();
})['catch'](message => {
fail(message);
done();
});
});
undo(graphics) {
graphics.remove(this.undoData.object);
return Promise.resolve();
}
};
undo(graphics) {
graphics.remove(this.undoData.object);
return Promise.resolve();
}
};
undo(graphics) {
graphics.setCssMaxDimension(this.undoData.size);
graphics.adjustCanvasDimension();
return Promise.resolve();
}
};
undo(graphics) {
graphics.add(this.undoData.objects);
return Promise.resolve();
}
};
undo(graphics) {
graphics.remove(this.undoData.object);
return Promise.resolve();
}
};
undo(graphics) {
const iconComp = graphics.getComponent(ICON);
const {object: icon, color} = this.undoData.object;
iconComp.setColor(color, icon);
return Promise.resolve();
}
};