terminalTheme.test.ts 956 B

1234567891011121314151617181920212223242526272829303132
  1. import { describe, expect, it } from "vitest";
  2. import type { ITheme } from "@xterm/xterm";
  3. import { restrictInheritedTerminalTheme } from "@/terminal/terminalTheme.js";
  4. describe("terminalTheme", () => {
  5. it("keeps app-controlled readable colors out of inherited profile colors", () => {
  6. const inherited = restrictInheritedTerminalTheme({
  7. background: "#111111",
  8. foreground: "#eeeeee",
  9. cursor: "#00ff00",
  10. cursorAccent: "#111111",
  11. red: "#ff0000",
  12. brightBlue: "#3399ff",
  13. } satisfies ITheme);
  14. expect(inherited).toEqual({
  15. red: "#ff0000",
  16. brightBlue: "#3399ff",
  17. });
  18. });
  19. it("drops inherited theme when it only contains app-controlled surface colors", () => {
  20. expect(
  21. restrictInheritedTerminalTheme({
  22. background: "#111111",
  23. foreground: "#eeeeee",
  24. cursor: "#00ff00",
  25. cursorAccent: "#111111",
  26. } satisfies ITheme),
  27. ).toBeUndefined();
  28. });
  29. });