| 1 | import { describe, expect, it } from "vite-plus/test"; |
| 2 | import { |
| 3 | clampThreadSidebarWidth, |
| 4 | resolveThreadSidebarMaximumWidth, |
| 5 | THREAD_SIDEBAR_MIN_WIDTH, |
| 6 | } from "./threadSidebarWidth"; |
| 7 | |
| 8 | describe("resolveThreadSidebarMaximumWidth", () => { |
| 9 | it("keeps the sidebar usable on a narrow viewport", () => { |
| 10 | expect(resolveThreadSidebarMaximumWidth(800)).toBe(THREAD_SIDEBAR_MIN_WIDTH); |
| 11 | expect(resolveThreadSidebarMaximumWidth(1200)).toBe(560); |
| 12 | }); |
| 13 | }); |
| 14 | |
| 15 | describe("clampThreadSidebarWidth", () => { |
| 16 | it("widens a stored width below the minimum", () => { |
| 17 | expect(clampThreadSidebarWidth(180, 560)).toBe(THREAD_SIDEBAR_MIN_WIDTH); |
| 18 | }); |
| 19 | |
| 20 | it("keeps widths inside the range and caps wide ones", () => { |
| 21 | expect(clampThreadSidebarWidth(300, 560)).toBe(300); |
| 22 | expect(clampThreadSidebarWidth(900, 560)).toBe(560); |
| 23 | }); |
| 24 | }); |