conversationLayout.test.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { describe, expect, it } from "vitest";
  2. import {
  3. CONVERSATION_DRAFT_CONTENT_WIDTH_CLASS_NAME,
  4. CONVERSATION_CONTENT_WITHOUT_STATUS_PANEL_WIDTH_CLASS_NAME,
  5. CONVERSATION_CONTENT_WITH_STATUS_PANEL_WIDTH_CLASS_NAME,
  6. getConversationContentWidthClassName,
  7. } from "@/v4/conversationLayout.js";
  8. describe("conversationLayout content width", () => {
  9. it("keeps a true draft on the compact width", () => {
  10. expect(
  11. getConversationContentWidthClassName({
  12. centeredEmptyLayout: true,
  13. statusPanelLayout: "none",
  14. }),
  15. ).toBe(CONVERSATION_DRAFT_CONTENT_WIDTH_CLASS_NAME);
  16. });
  17. it("uses 1280px as the wide breakpoint when the status panel reserves space", () => {
  18. expect(
  19. getConversationContentWidthClassName({
  20. centeredEmptyLayout: false,
  21. statusPanelLayout: "auto",
  22. }),
  23. ).toBe(CONVERSATION_CONTENT_WITH_STATUS_PANEL_WIDTH_CLASS_NAME);
  24. expect(CONVERSATION_CONTENT_WITH_STATUS_PANEL_WIDTH_CLASS_NAME).toBe(
  25. "w-full @min-[864px]/conversation:w-[calc(100%_-_6rem)] @min-[864px]/conversation:max-w-4xl @min-[1280px]/conversation:w-[calc(100%_-_24rem)] @min-[1280px]/conversation:max-w-6xl",
  26. );
  27. });
  28. it("delays the wide width to 1280px when the status panel is collapsed or absent", () => {
  29. expect(
  30. getConversationContentWidthClassName({
  31. centeredEmptyLayout: false,
  32. statusPanelLayout: "none",
  33. }),
  34. ).toBe(CONVERSATION_CONTENT_WITHOUT_STATUS_PANEL_WIDTH_CLASS_NAME);
  35. expect(CONVERSATION_CONTENT_WITHOUT_STATUS_PANEL_WIDTH_CLASS_NAME).toBe(
  36. "w-full @min-[864px]/conversation:w-[calc(100%_-_6rem)] @min-[864px]/conversation:max-w-4xl @min-[1280px]/conversation:w-[calc(100%_-_24rem)] @min-[1280px]/conversation:max-w-6xl",
  37. );
  38. });
  39. });