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:
19
apps/web/src/reader/locators.test.ts
Normal file
19
apps/web/src/reader/locators.test.ts
Normal 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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user