fix(tabs): restore previous tab after data tab close

This commit is contained in:
t8y2 committed 2026-07-02 00:48:30 +08:00
1 parent dfd1e7e6d1
commit 58e2d983c2
2 files changed
+40 -4

No files matched your search

+16
View File
@@ -101,6 +101,22 @@ test("renames query tab titles", () => {
assert.equal(tab?.customTitle, true);
});
test("closing an active data tab restores the previously focused query tab", () => {
setActivePinia(createPinia());
const store = useQueryStore();
const firstQueryId = store.createTab("conn-1", "db", "query_1", "query");
store.createTab("conn-1", "db", "query_2", "query");
store.activeTabId = firstQueryId;
const dataTabId = store.createTab("conn-1", "db", "public.users", "data", "public");
assert.equal(store.activeTabId, dataTabId);
store.closeTab(dataTabId);
assert.equal(store.activeTabId, firstQueryId);
});
test("linkExternalSqlPath records the local path and detaches saved SQL", () => {
setActivePinia(createPinia());
const store = useQueryStore();