diff --git a/apps/desktop/src/components/editor/EditorSettingsDialog.vue b/apps/desktop/src/components/editor/EditorSettingsDialog.vue index 025ecb0ce8..b1267ddfc3 100644 --- a/apps/desktop/src/components/editor/EditorSettingsDialog.vue +++ b/apps/desktop/src/components/editor/EditorSettingsDialog.vue @@ -3902,6 +3902,14 @@ onUnmounted(() => { + +
+ +
+
+
+
+
@@ -4229,16 +4237,6 @@ onUnmounted(() => {
- - - - -
- -
-
-
-
diff --git a/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.previewPosition.spec.ts b/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.previewPosition.spec.ts new file mode 100644 index 0000000000..26f1471d25 --- /dev/null +++ b/apps/desktop/src/components/editor/__tests__/EditorSettingsDialog.previewPosition.spec.ts @@ -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();"); + }); +});