fix: TOC PDF - forcer le rechargement de l'iframe (BUG-063 complement)
This commit is contained in:
@@ -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 },
|
||||
);
|
||||
});
|
||||
|
||||
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user