Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

PreviewPanelShell.test.ts

33 lines1.1 KB

1import { describe, expect, it } from "vite-plus/test";
2​
3import { getPreviewPanelMaxWidth } from "./PreviewPanelShell";
4​
5describe("getPreviewPanelMaxWidth", () => {
6 it("allows the panel to use 70% of an ultra-wide viewport without a pixel ceiling", () => {
7 expect(getPreviewPanelMaxWidth(6_000)).toBe(4_200);
8 });
9​
10 it("rounds fractional CSS pixels down", () => {
11 expect(getPreviewPanelMaxWidth(2_001)).toBe(1_400);
12 });
13​
14 it("reserves the sibling column minimum when the flex row is known", () => {
15 expect(getPreviewPanelMaxWidth(1_512, 1_256)).toBe(896);
16 });
17​
18 it("keeps the fraction cap when the row is wide enough for both columns", () => {
19 expect(getPreviewPanelMaxWidth(3_000, 2_900)).toBe(2_100);
20 });
21​
22 it("rounds fractional row widths down", () => {
23 expect(getPreviewPanelMaxWidth(1_512, 1_256.6)).toBe(896);
24 });
25​
26 it("never drops below the panel minimum when the row cannot fit both columns", () => {
27 expect(getPreviewPanelMaxWidth(1_000, 700)).toBe(360);
28 });
29​
30 it("stays at the panel minimum even when the row is narrower than the reservation", () => {
31 expect(getPreviewPanelMaxWidth(1_512, 300)).toBe(360);
32 });
33});