feat(cv): harden multi-page builder
Wrap pathological content, paginate oversized entries, measure A4 and Letter previews correctly, unify section ordering, and gate stored-output actions on saved state.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { moveItem, wrapSelection } from "./cvBuilder";
|
||||
import { getCvPageCount, getCvPageMetrics, moveItem, wrapSelection } from "./cvBuilder";
|
||||
|
||||
describe("moveItem", () => {
|
||||
test("moves an item forward", () => {
|
||||
@@ -37,3 +37,17 @@ describe("wrapSelection", () => {
|
||||
expect(r.text.slice(r.selStart, r.selEnd)).toBe("docs");
|
||||
});
|
||||
});
|
||||
|
||||
describe("CV page measurement", () => {
|
||||
test("uses the selected physical page size", () => {
|
||||
expect(getCvPageMetrics("a4")).toMatchObject({ widthMm: 210, heightMm: 297 });
|
||||
expect(getCvPageMetrics("letter")).toMatchObject({ widthMm: 215.9, heightMm: 279.4 });
|
||||
});
|
||||
|
||||
test("rounds layout pixels without hiding partial pages", () => {
|
||||
const { heightPx } = getCvPageMetrics("a4");
|
||||
expect(getCvPageCount(Math.ceil(heightPx), heightPx)).toBe(1);
|
||||
expect(getCvPageCount(heightPx + 20, heightPx)).toBe(2);
|
||||
expect(getCvPageCount(heightPx * 2 + 20, heightPx)).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user