mirror of
https://github.com/outline/outline.git
synced 2026-12-06 03:05:08 +03:00
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.
25 lines
688 B
TypeScript
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,
|
|
});
|
|
});
|
|
});
|