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

PreviewPanelShell.test.ts

23 lines814 Bytes

1import { jsx } from "react/jsx-runtime";
2import { renderToStaticMarkup } from "react-dom/server";
3import { describe, expect, it } from "vite-plus/test";
4​
5import { getPreviewPanelMaxWidth, PreviewPanelShell } from "./PreviewPanelShell";
6​
7describe("getPreviewPanelMaxWidth", () => {
8 it("allows the panel to use 70% of an ultra-wide viewport without a pixel ceiling", () => {
9 expect(getPreviewPanelMaxWidth(6_000)).toBe(4_200);
10 });
11​
12 it("rounds fractional CSS pixels down", () => {
13 expect(getPreviewPanelMaxWidth(2_001)).toBe(1_400);
14 });
15​
16 it("keeps inline panels inside their containing workspace", () => {
17 const markup = renderToStaticMarkup(
18 jsx(PreviewPanelShell, { mode: "inline", defaultWidth: 1_000, children: "Panel" }),
19 );
20​
21 expect(markup).toContain("max-w-full");
22 });
23});