fix: TOC PDF - forcer le rechargement de l'iframe (BUG-063 complement)
CI / lint (push) Successful in 1m37s
CI / security (push) Successful in 1m15s
CI / test (push) Successful in 3m36s
CI / build (push) Successful in 59s
CI / e2e (push) Successful in 11m13s

This commit is contained in:
2026-09-17 21:16:46 -04:00
parent f7e068baed
commit 7f0f64a42e
13 changed files with 46 additions and 22 deletions
+3 -1
View File
@@ -101,9 +101,11 @@ test.describe('PDF viewer — TOC & plein largeur', () => {
await expect(tocLinks).toHaveCount(3, { timeout: 10000 });
await page.locator('#content-area .pdf-toc a[data-page="3"]').click();
// Le changement de query force un rechargement (un simple changement de
// fragment est ignoré par le lecteur PDF natif), puis #page=3 est appliqué.
await expect(page.locator('#content-area .pdf-iframe')).toHaveAttribute(
'src',
/\/pdf\/stream\?path=.*#page=3$/,
/\/pdf\/stream\?path=.*&_pdfpage=\d+#page=3$/,
{ timeout: 5000 },
);
});
+6 -2
View File
@@ -67,11 +67,15 @@ test("viewer.js — TOC links carry a data-page and never poke contentWindow", (
);
});
test("viewer.js — navigatePdfToPage reloads the iframe with the #page fragment", () => {
test("viewer.js — navigatePdfToPage forces a reload with the #page fragment", () => {
const fn = viewer.match(/export function navigatePdfToPage\(area, page\) \{([\s\S]*?)\n\}/);
assert.ok(fn, "navigatePdfToPage helper not found");
assert.match(fn[1], /data-pdf-url/, "the base URL must be preserved without the fragment");
assert.match(fn[1], /iframe\.src = `\$\{base\}#page=\$\{page\}`/, "the iframe must be reloaded with #page=N");
assert.match(
fn[1],
/_pdfpage=\$\{Date\.now\(\)\}#page=\$\{page\}/,
"the query must change to force a reload (a fragment-only change is ignored by the native viewer)",
);
});
test("style.css — full-bleed viewers ignore the centered reading width", () => {