automationCardBorderTokens.test.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { readFile } from "node:fs/promises";
  2. import { describe, expect, it } from "vitest";
  3. const [
  4. automationsSectionSource,
  5. offPeakTaskListSource,
  6. offPeakNewTaskEntrySource,
  7. automationDesignPrimitivesSource,
  8. ] = await Promise.all([
  9. readFile(
  10. new URL("../src/settings/AutomationsSection.tsx", import.meta.url),
  11. "utf8",
  12. ),
  13. readFile(
  14. new URL("../src/settings/OffPeakTaskList.tsx", import.meta.url),
  15. "utf8",
  16. ),
  17. readFile(
  18. new URL("../src/v4/OffPeakNewTaskEntry.tsx", import.meta.url),
  19. "utf8",
  20. ),
  21. readFile(
  22. new URL("../src/settings/AutomationDesignPrimitives.tsx", import.meta.url),
  23. "utf8",
  24. ),
  25. ]);
  26. describe("automation card border tokens", () => {
  27. it("aligns homepage and automation cards to the Card Border semantic token", () => {
  28. expect(offPeakNewTaskEntrySource).toContain(
  29. "rounded-2xl border border-card-border bg-background",
  30. );
  31. expect(automationsSectionSource).toContain(
  32. "rounded-xl border border-card-border bg-background",
  33. );
  34. expect(automationsSectionSource).toContain(
  35. "rounded-2xl border border-card-border bg-background",
  36. );
  37. expect(offPeakTaskListSource).toContain(
  38. "rounded-[10px] border border-card-border",
  39. );
  40. expect(automationDesignPrimitivesSource).toContain(
  41. "rounded-xl border border-dashed border-card-border bg-background",
  42. );
  43. });
  44. it("does not use weaker surface borders or inset shadows for automation cards", () => {
  45. expect(automationsSectionSource).not.toContain(
  46. "rounded-xl border border-surface bg-background",
  47. );
  48. expect(automationsSectionSource).not.toContain(
  49. "rounded-2xl border border-surface bg-background",
  50. );
  51. expect(offPeakTaskListSource).not.toContain(
  52. "shadow-[inset_0_0_0_1px_var(--color-surface)]",
  53. );
  54. expect(automationDesignPrimitivesSource).not.toContain(
  55. '"border border-surface bg-background"',
  56. );
  57. });
  58. });