mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-12 12:39:52 +08:00
fix(mcp-server): review fixes for the preview URL and the theme menu
The stalled-tab note names the page start_session opened (the shell with DRAWIO_PREVIEW_UI=shell) instead of the classic page. With the shell not built, start_session opens the classic page and the server says so at startup, as it does for a missing dist/drawio. BROWSER=none skips the system browser, as Vite and CRA dev servers do: the e2e tests set it. Without a fixed DRAWIO_UI, the shell's draw.io URL carries themes=1 so Extras > Theme is offered, as on the classic page.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import { readFileSync } from "node:fs"
|
||||
import { join } from "node:path"
|
||||
import { describe, expect, it } from "vitest"
|
||||
import { getDrawioSrc } from "@/lib/drawio/drawio-config"
|
||||
import { i18n } from "@/lib/i18n/config"
|
||||
import {
|
||||
getShellDictionary,
|
||||
@@ -59,6 +60,25 @@ describe("shell runtime config", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("shell draw.io URL", () => {
|
||||
it("offers draw.io's theme menu unless a theme is fixed", () => {
|
||||
// Embedded draw.io shows Extras > Theme only with themes=1 and no ui
|
||||
const free = new URL(
|
||||
getDrawioSrc({ editorUrl: "/drawio/index.html" }, false),
|
||||
)
|
||||
expect(free.searchParams.get("themes")).toBe("1")
|
||||
expect(free.searchParams.get("ui")).toBeNull()
|
||||
const fixed = new URL(
|
||||
getDrawioSrc(
|
||||
{ editorUrl: "/drawio/index.html", ui: "kennedy" },
|
||||
false,
|
||||
),
|
||||
)
|
||||
expect(fixed.searchParams.get("ui")).toBe("kennedy")
|
||||
expect(fixed.searchParams.get("themes")).toBeNull()
|
||||
})
|
||||
})
|
||||
|
||||
describe("shell language", () => {
|
||||
it("maps language tags to the dictionaries we have", () => {
|
||||
expect(matchLocale("en-US")).toBe("en")
|
||||
|
||||
Reference in New Issue
Block a user