feat(settings): preview theme and UI fonts on hover

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-09-08 01:21:12 +08:00
1 parent b4d807b818
commit 3ae1548de0
8 files changed
+194 -17

No files matched your search

@@ -0,0 +1,21 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
const dialogSource = readFileSync(new URL("../EditorSettingsDialog.vue", import.meta.url), "utf8");
const appSource = readFileSync(new URL("../../../App.vue", import.meta.url), "utf8");
describe("EditorSettingsDialog preview cleanup", () => {
it("keeps the existing draft lifecycle independent from page activity", () => {
expect(dialogSource).toContain("const settingsVisible = computed(() => isSettingsPage.value || props.open === true);");
expect(dialogSource).toContain("syncEditorSettingsDraftFromStore();");
});
it("clears previews when a mounted settings page becomes inactive", () => {
expect(appSource).toContain('v-if="settingsPageTabOpen"');
expect(appSource).toContain('v-show="settingsStore.settingsPageActive"');
expect(dialogSource).toContain("() => settingsStore.settingsPageActive");
expect(dialogSource).toContain("if (isSettingsPage.value && !active)");
expect(dialogSource).toContain("clearThemePalettePreview();");
expect(dialogSource).toContain("clearUiFontFamilyPreview();");
});
});