ultisuite-client/lib/drive/docs-page-metrics.test.ts
R3D347HR4Y 76eff3c351
Some checks are pending
E2E / Playwright e2e (push) Waiting to run
feat(drive): enhance document layout with new page separators and margin masks
- Introduced `DocsPageSeparators` component to manage visual gaps between pages in the document editor.
- Updated `DocsBodyMarginMasks` to include dark mode support for improved styling.
- Refactored `DocsPageViewInner` to integrate new separators and margin masks, enhancing layout consistency.
- Adjusted layout constants to increase the gap between stacked pages for better visual separation.
- Improved test coverage for page flow calculations and layout metrics.
2026-06-15 17:28:02 +02:00

37 lines
1.0 KiB
TypeScript

import assert from "node:assert/strict"
import { describe, it } from "node:test"
import {
computePageCount,
computePageMetrics,
computeProseMinHeight,
computeStackHeight,
} from "./docs-page-metrics.ts"
describe("docs-page-metrics", () => {
const metrics = computePageMetrics({
widthPx: 794,
heightPx: 1122,
marginsPx: { top: 96, right: 96, bottom: 96, left: 96 },
headerMarginMm: 12.7,
footerMarginMm: 12.7,
})
it("computes body area height from margins", () => {
assert.equal(metrics.bodyAreaHeight, 1122 - 96 - 96)
})
it("computes page count from content height", () => {
assert.equal(computePageCount(400, metrics), 1)
assert.equal(computePageCount(metrics.bodyAreaHeight + 1, metrics), 2)
})
it("computes stack height with page gaps", () => {
assert.equal(computeStackHeight(2, 1122), 1122 * 2 + 24)
})
it("computes prose min height with inter-page spacers", () => {
const minH = computeProseMinHeight(2, metrics)
assert.equal(minH, metrics.bodyAreaHeight * 2 + metrics.interPageSpacer)
})
})