diff --git a/make-pdf/test/image-policy.test.ts b/make-pdf/test/image-policy.test.ts index e46f8eb4e..b0c635519 100644 --- a/make-pdf/test/image-policy.test.ts +++ b/make-pdf/test/image-policy.test.ts @@ -17,7 +17,9 @@ import { const silent = { warn: () => {} }; // 6.5in content box → threshold = 6.5 × 96 × 2.5 = 1560 CSS px. -const OPTS = { contentWidthIn: 6.5, ...silent }; +// Letter landscape content box: 9in wide × 6.5in tall. +const LANDSCAPE = { contentWIn: 9, contentHIn: 6.5 }; +const OPTS = { contentWidthIn: 6.5, landscape: LANDSCAPE, ...silent }; function img(attrs: string): string { return `
(no figure), so a figure-scoped cap alone lets
+ // wide screenshots run off the page edge — the exact regression this pins.
+ test("emits a global img max-width cap (zero truncation invariant)", () => {
+ const css = printCss();
+ expect(css).toMatch(/(^|\n)img\s*\{\s*max-width:\s*100%;\s*height:\s*auto;\s*\}/);
+ });
+
+ test("typography floor: body 12pt, poster cover, readable TOC", () => {
+ const css = printCss({ cover: true, toc: true });
+ expect(css).toContain("font-size: 12pt"); // body
+ expect(css).toMatch(/\.cover h1\.cover-title\s*\{[^}]*font-size:\s*56pt/);
+ expect(css).toMatch(/\.cover \.cover-meta\s*\{[^}]*font-size:\s*13pt/);
+ expect(css).toMatch(/\.toc li\s*\{[^}]*font-size:\s*12pt/);
+ });
+
+ test("page-wide carries the named page and NO height/flex centering", () => {
+ const css = printCss();
+ expect(css).toMatch(/\.page-wide\s*\{[^}]*page:\s*wide/);
+ // Centering is computed by image-policy as an inline margin-top. CSS
+ // flex/min-height centering fragments into phantom empty landscape pages
+ // in Chromium — this pins the regression (landscape-gate: 5 pages for 3
+ // promotions, bisected to min-height at any value).
+ expect(css).not.toMatch(/\.page-wide\s*\{[^}]*min-height/);
+ expect(css).not.toMatch(/\.page-wide\s*\{[^}]*flex/);
+ });
+
test("font stacks include Liberation Sans adjacent to Helvetica", () => {
const css = printCss({ confidential: true });
// Body stack