mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-01 14:12:51 +00:00
fix(settings): preserve valid legacy font fallback
This commit is contained in:
@@ -705,6 +705,20 @@ describe("appearance settings", () => {
|
||||
expect((await loadAppSettingsFromStorage(deps)).uiBaseFontSize).toBe(16);
|
||||
});
|
||||
|
||||
it("falls back to a valid legacy interface scale when the explicit base size is invalid", async () => {
|
||||
const deps = makeDeps({
|
||||
storage: createInMemoryKeyValueStorage({
|
||||
[APP_SETTINGS_KEY]: JSON.stringify({ uiBaseFontSize: "abc", uiFontSize: 17 }),
|
||||
}),
|
||||
});
|
||||
|
||||
const result = await loadAppSettingsFromStorage(deps);
|
||||
const persisted = JSON.parse(deps.storage.entries.get(APP_SETTINGS_KEY) ?? "null");
|
||||
|
||||
expect(result.uiBaseFontSize).toBe(15);
|
||||
expect(persisted).toMatchObject({ uiBaseFontSize: 15, uiFontSize: 17 });
|
||||
});
|
||||
|
||||
it("clamps the UI base font size into range and rejects non-numeric values", async () => {
|
||||
const deps = makeDeps({
|
||||
storage: createInMemoryKeyValueStorage({
|
||||
|
||||
@@ -182,7 +182,7 @@ const StoredAppSettingsSchema = z
|
||||
monoFontFamily: sanitizedFontFamily().catch(""),
|
||||
uiBaseFontSize: clampedNumber(MIN_UI_BASE_FONT_SIZE, MAX_UI_BASE_FONT_SIZE)
|
||||
.optional()
|
||||
.catch(DEFAULT_UI_BASE_FONT_SIZE),
|
||||
.catch(undefined),
|
||||
contentFontSize: clampedNumber(MIN_CONTENT_FONT_SIZE, MAX_CONTENT_FONT_SIZE)
|
||||
.optional()
|
||||
.catch(DEFAULT_CONTENT_FONT_SIZE),
|
||||
|
||||
Reference in New Issue
Block a user