Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(ci): sync frontend tests with grid changes

t8y208365d73eb3d
diff --git a/apps/desktop/src/components/structure/TableStructureEditor.primaryKey.spec.ts b/apps/desktop/src/components/structure/TableStructureEditor.primaryKey.spec.ts
index c46cd21a15..9004c148d1 100644
--- a/apps/desktop/src/components/structure/TableStructureEditor.primaryKey.spec.ts
+++ b/apps/desktop/src/components/structure/TableStructureEditor.primaryKey.spec.ts
@@ -14,6 +14,7 @@ const mocks = vi.hoisted(() => ({
executeQuery: vi.fn(),
listDataTypes: vi.fn(),
buildTableStructureChangeSql: vi.fn(),
+ buildMysqlAutoIncrementSql: vi.fn(),
updateEditorSettings: vi.fn(),
loadObjectDdl: vi.fn(),
invalidateObjectDdl: vi.fn(),
@@ -227,6 +228,7 @@ vi.mock("@/lib/backend/api", () => ({
executeQuery: mocks.executeQuery,
listDataTypes: mocks.listDataTypes,
buildTableStructureChangeSql: mocks.buildTableStructureChangeSql,
+ buildMysqlAutoIncrementSql: mocks.buildMysqlAutoIncrementSql,
buildTableOwnerChangeSql: mocks.buildTableOwnerChangeSql,
getTablePartitionStatus: mocks.getTablePartitionStatus,
getTableOwner: mocks.getTableOwner,
diff --git a/apps/desktop/src/components/structure/__tests__/TableStructureEditor.concurrentTransition.spec.ts b/apps/desktop/src/components/structure/__tests__/TableStructureEditor.concurrentTransition.spec.ts
index 23be36b37f..0322028205 100644
--- a/apps/desktop/src/components/structure/__tests__/TableStructureEditor.concurrentTransition.spec.ts
+++ b/apps/desktop/src/components/structure/__tests__/TableStructureEditor.concurrentTransition.spec.ts
@@ -14,6 +14,7 @@ const mocks = vi.hoisted(() => ({
executeQuery: vi.fn(),
listDataTypes: vi.fn(),
buildTableStructureChangeSql: vi.fn(),
+ buildMysqlAutoIncrementSql: vi.fn(),
updateEditorSettings: vi.fn(),
loadObjectDdl: vi.fn(),
invalidateObjectDdl: vi.fn(),
@@ -242,6 +243,7 @@ vi.mock("@/lib/backend/api", () => ({
executeQuery: mocks.executeQuery,
listDataTypes: mocks.listDataTypes,
buildTableStructureChangeSql: mocks.buildTableStructureChangeSql,
+ buildMysqlAutoIncrementSql: mocks.buildMysqlAutoIncrementSql,
buildTableOwnerChangeSql: mocks.buildTableOwnerChangeSql,
getTablePartitionStatus: mocks.getTablePartitionStatus,
getTableOwner: mocks.getTableOwner,
diff --git a/apps/desktop/src/lib/__tests__/dataGrid/gridSelection.spec.ts b/apps/desktop/src/lib/__tests__/dataGrid/gridSelection.spec.ts
index e3a02cbd31..f1c4caf961 100644
--- a/apps/desktop/src/lib/__tests__/dataGrid/gridSelection.spec.ts
+++ b/apps/desktop/src/lib/__tests__/dataGrid/gridSelection.spec.ts
@@ -67,7 +67,16 @@ describe("gridSelection", () => {
["single cell", [[8]], 1, 1, 8],
["row", [[1, 3]], 2, 1, 2],
["column", [[1], [3]], 2, 2, 2],
- ["range", [[1, 2], [3, 4]], 4, 2, 2.5],
+ [
+ "range",
+ [
+ [1, 2],
+ [3, 4],
+ ],
+ 4,
+ 2,
+ 2.5,
+ ],
] as const)("averages a %s selection without changing its counts", (_label, rows, cellCount, rowCount, average) => {
expect(summarizeSelection({ columns: [], rows: rows.map((row) => [...row]) })).toMatchObject({ cellCount, rowCount, average });
});
diff --git a/apps/desktop/src/lib/__tests__/editor/keyboardShortcuts.spec.ts b/apps/desktop/src/lib/__tests__/editor/keyboardShortcuts.spec.ts
index dcc58f98cc..eba0f5711a 100644
--- a/apps/desktop/src/lib/__tests__/editor/keyboardShortcuts.spec.ts
+++ b/apps/desktop/src/lib/__tests__/editor/keyboardShortcuts.spec.ts
@@ -97,9 +97,9 @@ describe("keyboard shortcut matching", () => {
});
it("matches only the configured go-to-column shortcut", () => {
- expect(isGoToColumnShortcut({ key: "g", ctrlKey: true }, { goToColumn: "Mod+G" })).toBe(true);
- expect(isGoToColumnShortcut({ key: "g", ctrlKey: true, shiftKey: true }, { goToColumn: "Mod+G" })).toBe(false);
- expect(isGoToColumnShortcut({ key: "j", ctrlKey: true }, { goToColumn: "Mod+G" })).toBe(false);
+ expect(isGoToColumnShortcut({ key: "g", ctrlKey: true }, { goToColumn: "Mod+G" }, "Win32")).toBe(true);
+ expect(isGoToColumnShortcut({ key: "g", ctrlKey: true, shiftKey: true }, { goToColumn: "Mod+G" }, "Win32")).toBe(false);
+ expect(isGoToColumnShortcut({ key: "j", ctrlKey: true }, { goToColumn: "Mod+G" }, "Win32")).toBe(false);
});
it("does not match an empty or composing go-to-column shortcut", () => {
diff --git a/apps/desktop/src/lib/editor/keyboardShortcuts.ts b/apps/desktop/src/lib/editor/keyboardShortcuts.ts
index ab2abf8b3f..bc88feedd5 100644
--- a/apps/desktop/src/lib/editor/keyboardShortcuts.ts
+++ b/apps/desktop/src/lib/editor/keyboardShortcuts.ts
@@ -211,8 +211,8 @@ export function isDeleteCurrentRowShortcut(event: ShortcutLikeEvent, shortcuts?:
return matchesShortcut(event, actionShortcut("deleteCurrentRow", shortcuts));
}
-export function isGoToColumnShortcut(event: ShortcutLikeEvent, shortcuts?: Partial<ShortcutSettings>): boolean {
- return matchesShortcut(event, actionShortcut("goToColumn", shortcuts));
+export function isGoToColumnShortcut(event: ShortcutLikeEvent, shortcuts?: Partial<ShortcutSettings>, platform = globalThis.navigator?.platform || ""): boolean {
+ return matchesShortcut(event, actionShortcut("goToColumn", shortcuts, platform), platform);
}
export function isGoToFirstPageShortcut(event: ShortcutLikeEvent, shortcuts?: Partial<ShortcutSettings>): boolean {
diff --git a/packages/app-tests/canvasDataGridRenderer.test.ts b/packages/app-tests/canvasDataGridRenderer.test.ts
index 79cc29d743..ed0ae730fb 100644
--- a/packages/app-tests/canvasDataGridRenderer.test.ts
+++ b/packages/app-tests/canvasDataGridRenderer.test.ts
@@ -47,7 +47,7 @@ test("DataGrid forwards hover action reservation only for right-aligned canvas c
const source = readFileSync("apps/desktop/src/components/grid/DataGrid.vue", "utf8");
assert.match(source, /columnAligns\.value\[cell\.visibleColIdx\] !== "right"/);
- assert.match(source, /reservedWidth: canvasDataGridActionReservedWidth\(cell\.canQuickDownload, !!cell\.foreignKey\)/);
+ assert.match(source, /reservedWidth: canvasDataGridActionReservedWidth\(cell\.canQuickDownload, !!cell\.foreignKey, cellDetailButtonEnabled\.value\)/);
assert.match(source, /rightAlignedActionCell: canvasRightAlignedActionCell\.value/);
});
diff --git a/packages/app-tests/keyboardShortcuts.test.ts b/packages/app-tests/keyboardShortcuts.test.ts
index fcf3e3fc87..3a3cf1e268 100644
--- a/packages/app-tests/keyboardShortcuts.test.ts
+++ b/packages/app-tests/keyboardShortcuts.test.ts
@@ -392,8 +392,9 @@ test("matches Cmd+S for saving", () => {
assert.equal(isSaveShortcut({ key: "s", metaKey: true }), true);
});
-test("matches Mod+D for copying current row", () => {
- assert.equal(isCopyCurrentRowShortcut({ key: "d", metaKey: true }), true);
+test("leaves copy current row disabled by default while honoring custom shortcuts", () => {
+ assert.equal(isCopyCurrentRowShortcut({ key: "d", metaKey: true }), false);
+ assert.equal(isCopyCurrentRowShortcut({ key: "d", altKey: true }, { copyCurrentRow: "Alt+D" }), true);
});
test("matches Delete for deleting current row", () => {
diff --git a/packages/app-tests/settingsStore.test.ts b/packages/app-tests/settingsStore.test.ts
index f5192cc476..1ecdaa9fb5 100644
--- a/packages/app-tests/settingsStore.test.ts
+++ b/packages/app-tests/settingsStore.test.ts
@@ -390,7 +390,8 @@ test("defaults shortcut settings", () => {
assert.equal(settings.shortcuts.executeSql, "Mod+Enter");
assert.equal(settings.shortcuts.saveSql, "Mod+S");
assert.equal(settings.shortcuts.extendSelection, "Alt+W");
- assert.equal(settings.shortcuts.copyCurrentRow, "Mod+D");
+ assert.equal(settings.shortcuts.editTableStructure, "Mod+D");
+ assert.equal(settings.shortcuts.copyCurrentRow, "");
assert.equal(settings.shortcuts.deleteCurrentRow, "Delete");
assert.equal(settings.shortcuts.goToFirstPage, "");
assert.equal(settings.shortcuts.goToPreviousPage, "");