interactionThemeTokens.test.ts 1.0 KB

123456789101112131415161718192021222324
  1. import { readFileSync } from "node:fs";
  2. import { describe, expect, it } from "vitest";
  3. const styles = readFileSync("packages/ui/src/styles.css", "utf8");
  4. describe("blocking interaction theme tokens", () => {
  5. it("defines Ask blue and confirmation green semantics for every supported theme", () => {
  6. const tokens = [
  7. "--color-interaction-ask-surface",
  8. "--color-interaction-ask-foreground",
  9. "--color-interaction-ask-fill",
  10. "--color-interaction-confirmation-surface",
  11. "--color-interaction-confirmation-foreground",
  12. ];
  13. for (const token of tokens) {
  14. expect(styles.match(new RegExp(`${token}:`, "g"))).toHaveLength(4);
  15. }
  16. expect(styles).toContain("--color-interaction-ask-fill: rgba(70, 191, 114, 0.2);");
  17. expect(styles).toContain("--color-interaction-ask-fill: rgba(70, 191, 114, 0.24);");
  18. expect(styles).toContain("--color-interaction-confirmation-surface: #eaf7ee;");
  19. expect(styles).toContain("--color-interaction-confirmation-surface: rgba(70, 191, 114, 0.16);");
  20. });
  21. });