toolCommandTypography.test.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. import { readFileSync } from "node:fs";
  2. import { describe, expect, it } from "vitest";
  3. function readRenderer(name: string): string {
  4. return readFileSync(
  5. `packages/ui/src/ToolCallBlocks/renderers/${name}.tsx`,
  6. "utf8",
  7. );
  8. }
  9. describe("tool command typography", () => {
  10. it("uses the UI sans font for Execute command text while preserving mono output", () => {
  11. const source = readRenderer("execute");
  12. expect(source).toContain(
  13. '<code className="truncate font-sans">{secondaryText}</code>',
  14. );
  15. expect(source).toContain(
  16. 'className="flex items-start gap-2 font-sans text-ui-base text-foreground"',
  17. );
  18. // 输出已抽到独立组件,字体断言跟随组件归属,不再绑定旧容器高度。
  19. expect(readRenderer("ExecuteOutput")).toContain("font-mono text-ui-base");
  20. });
  21. it("uses the UI sans font for readonly Shell commands in Explore summaries", () => {
  22. const source = readRenderer("explore");
  23. expect(source).toContain(
  24. '<code className="min-w-0 truncate font-sans">{secondaryText}</code>',
  25. );
  26. });
  27. });