backpack-ui
Version:
Lonely Planet's Components
33 lines (27 loc) • 754 B
JavaScript
import { expect } from "chai";
import {
rgb,
darken,
lighten,
} from "../../src/utils/color";
describe("rgb", () => {
it("should convert a hex value to rgb", () => {
expect(rgb("#406274")).to.equal("64,98,116");
});
});
describe("darken", () => {
it("should darken white by an amount of 10", () => {
expect(darken("#fff", 10)).to.equal("#E6E6E6");
});
});
describe("lighten", () => {
it("should lighten red by an amount of 20", () => {
expect(lighten("red", 20)).to.equal("#FF3333");
});
it("should not lighten white by any amount", () => {
expect(lighten("#fff", 5)).to.equal("#FFFFFF");
});
it("should not lighten black by any amount", () => {
expect(lighten("#000", 40)).to.equal("#000000");
});
});