feat(webui): refine appearance and add custom reading sizes

This commit is contained in:
Xubin Ren committed 2026-10-25 22:14:58 +08:00
1 parent b048cf44f7
commit ef8271b2c0
38 files changed
+1148 -213

No files matched your search

+16
View File
@@ -47,6 +47,22 @@ describe("local preferences", () => {
});
});
it("round-trips a custom reading size without resetting other preferences", () => {
const preferences = { ...DEFAULT_LOCAL_PREFS, readingTextSize: "custom" as const,
customReadingTextSize: 24, notificationSound: true, codeWrap: false };
writeLocalPreferences(preferences);
expect(readLocalPreferences()).toEqual(preferences);
});
it.each([[40, 28], [8, 14], [19.6, 20], ["22", 18], [null, 18]])(
"normalizes persisted custom size %j to %s", (stored, expected) => {
localStorage.setItem(LOCAL_PREFS_STORAGE_KEY, JSON.stringify({
schemaVersion: 1, readingTextSize: "custom", customReadingTextSize: stored, codeWrap: false,
}));
expect(readLocalPreferences()).toMatchObject({ readingTextSize: "custom", customReadingTextSize: expected, codeWrap: false });
},
);
it("keeps browser notifications opt-in", () => {
expect(DEFAULT_LOCAL_PREFS.browserNotifications).toBe(false);
expect(readLocalPreferences().browserNotifications).toBe(false);