feat(ui): refresh latest ddl on demand
This commit is contained in:
17 files changed
+186
-11
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const source = readFileSync(new URL("../DdlViewDialog.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("DdlViewDialog freshness", () => {
|
||||
it("uses the persisted refresh preference when the dialog opens", () => {
|
||||
expect(source).toMatch(/watch\(\s*\(\) => props\.open,[\s\S]*?await loadDdl\(settingsStore\.editorSettings\.refreshDdlOnOpen\);/);
|
||||
});
|
||||
|
||||
it("refreshes the current DDL immediately when the preference is enabled", () => {
|
||||
expect(source).toMatch(/function setRefreshDdlOnOpen\(value: boolean\)[\s\S]*?if \(value\) void loadDdl\(true\);/);
|
||||
});
|
||||
|
||||
it("explains how the refresh preference affects cached DDL", () => {
|
||||
expect(source).toContain('import { HelpTooltip } from "@/components/ui/tooltip";');
|
||||
expect(source).toMatch(/<HelpTooltip :label="t\('contextMenu\.refreshDdlOnOpenHint'\)"[\s\S]*?t\("contextMenu\.refreshDdlOnOpenHint"\)[\s\S]*?<\/HelpTooltip>/);
|
||||
});
|
||||
});
|
||||
+6
@@ -47,6 +47,12 @@ describe("ObjectBrowser table metadata refresh", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("shares the DDL refresh preference and exposes an explicit refresh action", () => {
|
||||
expect(source).toContain("async function fetchTableDdl(force = settingsStore.editorSettings.refreshDdlOnOpen)");
|
||||
expect(source).toContain('@click="refreshActiveTableInfo"');
|
||||
expect(source).not.toContain("setTableInfoRefreshDdlOnOpen");
|
||||
});
|
||||
|
||||
it("keeps automatic object reloads free of extra metadata requests", () => {
|
||||
expect(functionBody("reload")).not.toContain("refreshActiveTableInfo");
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user