Files
outline/shared/editor/lib/pdf.test.ts
T
Tom Moor 97c780fd04 feat: Consistent resize handles for images, videos, PDFs and embeds
All media get side, bottom and corner handles driven by one lock rule.
Images and videos stay locked. PDFs and embeds can be unlocked to resize
each axis independently.
2026-11-20 14:58:35 -05:00

25 lines
688 B
TypeScript

import { pdfNaturalHeight, pdfNaturalWidth, resolvePDFDimensions } from "./pdf";
describe("resolvePDFDimensions", () => {
it("returns the natural dimensions when none are stored", () => {
expect(resolvePDFDimensions(null, null)).toEqual({
width: pdfNaturalWidth,
height: pdfNaturalHeight,
});
});
it("keeps stored dimensions that do not match the natural ratio", () => {
expect(resolvePDFDimensions(700, 400)).toEqual({
width: 700,
height: 400,
});
});
it("derives a missing height from the natural ratio", () => {
expect(resolvePDFDimensions(384)).toEqual({
width: 384,
height: pdfNaturalHeight / 2,
});
});
});