fix(web,api): UI fiche livre et lecteur — progression, locators EPUB/PDF, styles

- web: BookPage/ReaderPage enrichis, sauvegarde de progression lecteur
- web: locators EPUB/PDF normalisés (+ tests), EpubReader/PdfReader ajustés
- web: nginx et service worker ajustés
- api: progress — corrections contrôleur/service

Refs: #13
This commit is contained in:
Git Agent
2026-08-23 10:32:44 +02:00
parent e94524f119
commit 85b56ef3b2
12 changed files with 254 additions and 54 deletions

View File

@ -0,0 +1,19 @@
import { describe, expect, it } from "vitest";
import { parsePdfPageLocator, pdfPagePercent } from "./locators";
describe("reader locators", () => {
it("parses valid PDF page locators", () => {
expect(parsePdfPageLocator("pdf:page:12")).toBe(12);
});
it("ignores invalid PDF locators", () => {
expect(parsePdfPageLocator("epub:start")).toBeNull();
expect(parsePdfPageLocator("pdf:page:0")).toBeNull();
});
it("bounds PDF page percentages", () => {
expect(pdfPagePercent(2, 4)).toBe(50);
expect(pdfPagePercent(8, 4)).toBe(100);
expect(pdfPagePercent(1, 0)).toBe(0);
});
});