@netdata/charts
Version:
Netdata frontend SDK and chart utilities
25 lines (24 loc) • 1.1 kB
JavaScript
;
var _makeGradientColors = _interopRequireDefault(require("./makeGradientColors"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
describe("lightenColor", function () {
it("returns a valid hex color", function () {
expect((0, _makeGradientColors["default"])("#00AB44")).toMatch(/^#[0-9a-f]{6}$/i);
});
it("returns a lighter version of the input color", function () {
expect((0, _makeGradientColors["default"])("#00AB44")).not.toBe("#00AB44");
});
it("returns the original color with factor 0", function () {
expect((0, _makeGradientColors["default"])("#00AB44", 0)).toBe("#00ab44");
});
it("returns white with factor 1", function () {
expect((0, _makeGradientColors["default"])("#00AB44", 1)).toBe("#ffffff");
});
it("returns white for black with factor 1", function () {
expect((0, _makeGradientColors["default"])("#000000", 1)).toBe("#ffffff");
});
it("respects custom factor", function () {
var light = (0, _makeGradientColors["default"])("#000000", 0.5);
expect(light).toBe("#808080");
});
});