Ouvrir rapidement un très grand livre et continuer la lecture sans attendre le chargement complet sur très mauvaise connexion. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
22 lines
1.1 KiB
TypeScript
22 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
||
import { adaptiveStatusLabel } from "./useAdaptiveReading";
|
||
|
||
describe("adaptive reading status", () => {
|
||
it("uses the short reader wording without a global percentage", () => {
|
||
expect(adaptiveStatusLabel("opening", false)).toBe("Ouverture de la page…");
|
||
expect(adaptiveStatusLabel("next", false)).toBe("Préparation de la page suivante…");
|
||
expect(adaptiveStatusLabel("neighbors", false)).toBe("Chargement des pages voisines…");
|
||
expect(adaptiveStatusLabel("slow", false)).toBe("Connexion lente. On charge d’abord cette page.");
|
||
expect(adaptiveStatusLabel("offline", false)).toBe("Hors connexion. La page déjà chargée reste disponible.");
|
||
|
||
for (const status of ["opening", "next", "neighbors", "slow", "offline", "idle"] as const) {
|
||
const label = adaptiveStatusLabel(status, false) ?? "";
|
||
expect(label).not.toMatch(/%|pourcentage|global|manifest|spine|range|etag|cache|resource|locator/i);
|
||
}
|
||
});
|
||
|
||
it("announces a lightweight resource when the manifest supports it", () => {
|
||
expect(adaptiveStatusLabel("opening", true)).toBe("Version allégée");
|
||
});
|
||
});
|