24 lines
814 B
TypeScript
24 lines
814 B
TypeScript
import { jsx } from "react/jsx-runtime";
|
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
import { describe, expect, it } from "vite-plus/test";
|
|
|
|
import { getPreviewPanelMaxWidth, PreviewPanelShell } from "./PreviewPanelShell";
|
|
|
|
describe("getPreviewPanelMaxWidth", () => {
|
|
it("allows the panel to use 70% of an ultra-wide viewport without a pixel ceiling", () => {
|
|
expect(getPreviewPanelMaxWidth(6_000)).toBe(4_200);
|
|
});
|
|
|
|
it("rounds fractional CSS pixels down", () => {
|
|
expect(getPreviewPanelMaxWidth(2_001)).toBe(1_400);
|
|
});
|
|
|
|
it("keeps inline panels inside their containing workspace", () => {
|
|
const markup = renderToStaticMarkup(
|
|
jsx(PreviewPanelShell, { mode: "inline", defaultWidth: 1_000, children: "Panel" }),
|
|
);
|
|
|
|
expect(markup).toContain("max-w-full");
|
|
});
|
|
});
|