diff --git a/WonderQ-Admin-UI-Vue/src/components/concierge/ConciergeAdvisorEditor.vue b/WonderQ-Admin-UI-Vue/src/components/concierge/ConciergeAdvisorEditor.vue index 48f109a..63108a1 100644 --- a/WonderQ-Admin-UI-Vue/src/components/concierge/ConciergeAdvisorEditor.vue +++ b/WonderQ-Admin-UI-Vue/src/components/concierge/ConciergeAdvisorEditor.vue @@ -37,14 +37,16 @@ function toDraft(advisor?: ConciergeAdvisor): ConciergeAdvisorCreate { diff --git a/WonderQ-Admin-UI-Vue/src/components/home/HomeContentEditor.vue b/WonderQ-Admin-UI-Vue/src/components/home/HomeContentEditor.vue index ed53de7..9158419 100644 --- a/WonderQ-Admin-UI-Vue/src/components/home/HomeContentEditor.vue +++ b/WonderQ-Admin-UI-Vue/src/components/home/HomeContentEditor.vue @@ -45,31 +45,33 @@ function updateLines(field: "detailParagraphs", value: string) { diff --git a/WonderQ-Admin-UI-Vue/src/components/layout/SettingsDrawer.vue b/WonderQ-Admin-UI-Vue/src/components/layout/SettingsDrawer.vue index 141c35d..21bf790 100644 --- a/WonderQ-Admin-UI-Vue/src/components/layout/SettingsDrawer.vue +++ b/WonderQ-Admin-UI-Vue/src/components/layout/SettingsDrawer.vue @@ -18,6 +18,7 @@ function reset() { diff --git a/WonderQ-Admin-UI-Vue/src/pages/drawer-editors.test.ts b/WonderQ-Admin-UI-Vue/src/pages/drawer-editors.test.ts new file mode 100644 index 0000000..edc8ec3 --- /dev/null +++ b/WonderQ-Admin-UI-Vue/src/pages/drawer-editors.test.ts @@ -0,0 +1,52 @@ +import { readFileSync } from "node:fs"; +import { describe, expect, it } from "vitest"; + +const readSource = (path: string) => readFileSync(new URL(path, import.meta.url), "utf8"); + +const homePage = readSource("./HomePage.vue"); +const wanfaPage = readSource("./WanfaPage.vue"); +const conciergePage = readSource("./ConciergePage.vue"); +const settingsDrawer = readSource("../components/layout/SettingsDrawer.vue"); +const styles = readSource("../styles.css"); + +const editorSources = [ + readSource("../components/site-config/SiteConfigEditor.vue"), + readSource("../components/home/HomeContentEditor.vue"), + readSource("../components/wanfa/WanfaCategoryEditor.vue"), + readSource("../components/wanfa/WanfaRouteEditor.vue"), + readSource("../components/concierge/ConciergeAdvisorEditor.vue"), +]; + +describe("side drawer editor contracts", () => { + it("keeps editor content scrollable and action buttons in a bottom action bar", () => { + for (const source of editorSources) { + expect(source).toMatch(/]*class="[^"]*drawer-editor-form[^"]*"/); + expect(source).toContain('class="drawer-editor-form__content"'); + expect(source).toContain('class="editor-actions"'); + } + + expect(styles).toMatch(/\.drawer-editor-form\s*\{[^}]*display:\s*flex/); + expect(styles).toMatch(/\.drawer-editor-form__content\s*\{[^}]*overflow-y:\s*auto/); + expect(styles).toMatch(/\.editor-actions\s*\{[^}]*margin-top:\s*0/); + }); + + it("closes both home configuration drawers after a successful save", () => { + expect(homePage).toMatch(/async function saveSiteItem\(\)[\s\S]*?closeEditorAfterSave\(\);/); + expect(homePage).toMatch(/async function saveHomeItem\(\)[\s\S]*?closeEditorAfterSave\(\);/); + }); + + it("keeps successful save closure wired for route and concierge drawers", () => { + expect(wanfaPage).toMatch(/async function saveCategory\(label: string\)[\s\S]*?categoryDrawer\.value = false;/); + expect(wanfaPage).toMatch(/async function saveRoute\([\s\S]*?details\.value = [\s\S]*?routeDrawer\.value = false;/); + expect(conciergePage).toMatch(/async function save\(input: ConciergeAdvisorCreate\)[\s\S]*?editorOpen\.value = false;/); + }); + + it("uses the non-deprecated value API in the settings drawer", () => { + expect(settingsDrawer).toContain(''); + expect(settingsDrawer).toContain(''); + expect(settingsDrawer).toContain(''); + expect(settingsDrawer).toContain(''); + expect(settingsDrawer).toContain(''); + expect(settingsDrawer).not.toContain('