feat(settings): move editor live preview near appearance controls

Closes #4346
This commit is contained in:
t8y2 committed 2026-08-24 23:59:42 +00:00
1 parent a6edbd7fcb
commit 2f464e0d33
2 files changed
+39 -10

No files matched your search

@@ -0,0 +1,31 @@
import { readFileSync } from "node:fs";
import { describe, expect, it } from "vitest";
const dialogSource = readFileSync(new URL("../EditorSettingsDialog.vue", import.meta.url), "utf8");
const editorSectionStart = dialogSource.indexOf(`activeSettingsTab === 'editor'`);
const formatterSectionStart = dialogSource.indexOf(`activeSettingsTab === 'formatter'`, editorSectionStart);
const editorSection = dialogSource.slice(editorSectionStart, formatterSectionStart);
describe("EditorSettingsDialog live preview placement", () => {
it("renders one preview after the appearance controls and before behavior settings", () => {
const fontFamily = editorSection.indexOf('t("settings.fontFamily")');
const theme = editorSection.indexOf('t("settings.theme")');
const fontSize = editorSection.indexOf('t("settings.fontSize")');
const preview = editorSection.indexOf('ref="previewRef"');
const executeMode = editorSection.indexOf("executeModeLabel");
expect(editorSectionStart).toBeGreaterThanOrEqual(0);
expect(formatterSectionStart).toBeGreaterThan(editorSectionStart);
expect(fontFamily).toBeGreaterThanOrEqual(0);
expect(theme).toBeGreaterThan(fontFamily);
expect(fontSize).toBeGreaterThan(theme);
expect(preview).toBeGreaterThan(fontSize);
expect(preview).toBeLessThan(executeMode);
expect(editorSection.match(/ref="previewRef"/g)).toHaveLength(1);
});
it("keeps the preview lifecycle tied to the same template ref", () => {
expect(dialogSource).toContain("watch(previewRef, async (el) => {");
expect(dialogSource).toContain("cleanupPreviewEditor();");
});
});