figspec

Unofficial static Figma frame/file viewer available as HTML CustomElement

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
import { describe, expect, it } from "vitest";

import { isTransparent } from "./colors";

describe("#isTransparent", () => {
  it("Should return `true` for transparent black", () => {
    expect(isTransparent({ r: 0, g: 0, b: 0, a: 0 })).toBe(true);
  });

  it("Should return `false` for non-transparent black", () => {
    expect(isTransparent({ r: 0, g: 0, b: 0, a: 0.5 })).toBe(false);
  });

  it("Should return `false` for transparent white", () => {
    expect(isTransparent({ r: 1, g: 1, b: 1, a: 0 })).toBe(false);
  });
});