test: drop source-text assertion tests and merge locale checks
This commit is contained in:
1 parent
349d77d180
commit
8897e12714
257 files changed
+166
-12815
No files matched your search
@@ -1,99 +0,0 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const tabBarSource = readFileSync(new URL("../AppTabBar.vue", import.meta.url), "utf8");
|
||||
const groupTabBarSource = readFileSync(new URL("../EditorGroupTabBar.vue", import.meta.url), "utf8");
|
||||
const groupSource = readFileSync(new URL("../EditorGroup.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("AppTabBar shared group navigation", () => {
|
||||
it("hosts existing group bars without rendering a second tab strip", () => {
|
||||
expect(tabBarSource).toContain("GROUP_TAB_BAR_PORTAL");
|
||||
expect(tabBarSource).toContain('v-for="group in queryStore.groups"');
|
||||
expect(tabBarSource).toContain(':data-special-page-tab-target="group.id"');
|
||||
expect(tabBarSource).not.toContain("overlayReturnTabs");
|
||||
expect(tabBarSource).not.toContain("data-return-tab");
|
||||
expect(tabBarSource).not.toContain("createRenameDuplicateTabItems");
|
||||
expect(groupSource).toContain("<Teleport defer");
|
||||
expect(groupSource).toContain("if (!tabBarPortal?.active.value) return undefined;");
|
||||
expect(groupSource).toContain(':disabled="!tabBarPortal?.active.value || !tabBarTarget"');
|
||||
});
|
||||
|
||||
it("retains targets while hiding inactive special content and follows all placements", () => {
|
||||
expect(tabBarSource).toContain('v-show="driverStoreActive || pluginCenterActive || settingsPageActive"');
|
||||
expect(tabBarSource).toContain("data-special-page-navigation");
|
||||
expect(tabBarSource).toContain("data-special-page-content");
|
||||
expect(tabBarSource).toContain("<slot />");
|
||||
for (const layout of ["flex-col", "flex-col-reverse", "flex-row", "flex-row-reverse"]) {
|
||||
expect(tabBarSource).toContain(layout);
|
||||
}
|
||||
expect(tabBarSource).toContain("props.tabBarCollapsed");
|
||||
expect(tabBarSource).toContain("props.tabBarWidth");
|
||||
});
|
||||
|
||||
it("scopes the close-other shortcut to the active tab's owner group", () => {
|
||||
expect(tabBarSource).toContain("closeOtherTabsInGroup(ownerGroup.id, activeTabId)");
|
||||
});
|
||||
});
|
||||
|
||||
describe("AppTabBar close confirmation layout", () => {
|
||||
it("allows long unbroken tab titles to shrink and wrap inside the dialog", () => {
|
||||
expect(tabBarSource).toMatch(/<DialogContent class="[^"]*\bmin-w-0\b[^"]*\bsm:max-w-md\b/);
|
||||
expect(tabBarSource).toMatch(/<div class="[^"]*\bmin-w-0\b[^"]*\bspace-y-2\b">\s*<p class="[^"]*\bwrap-anywhere\b/);
|
||||
});
|
||||
|
||||
it("keeps all single and bulk close actions while allowing the footer to wrap", () => {
|
||||
expect(tabBarSource).toMatch(/<DialogFooter class="[^"]*\bmin-w-0\b[^"]*\bsm:flex-wrap\b">/);
|
||||
expect(tabBarSource).toContain('v-if="showCloseConfirmBulkActions" variant="secondary" class="border-border" @click="handleDiscardAllAndClose"');
|
||||
expect(tabBarSource).toContain('v-if="showCloseConfirmBulkActions" @click="handleSaveAllAndClose"');
|
||||
expect(tabBarSource).toContain('variant="secondary" class="border-border" @click="handleDiscardAndClose"');
|
||||
expect(tabBarSource).toContain('@click="handleSaveAndClose"');
|
||||
expect(tabBarSource).toContain('@click="handleCancelClose"');
|
||||
});
|
||||
|
||||
it("shows the dirty tab list using the shared tab title presentation", () => {
|
||||
const start = tabBarSource.indexOf('v-for="tab in closeConfirmDirtyTabs"');
|
||||
const end = tabBarSource.indexOf("</PopoverContent>", start);
|
||||
expect(start).toBeGreaterThanOrEqual(0);
|
||||
expect(end).toBeGreaterThan(start);
|
||||
expect(tabBarSource.slice(start, end)).toContain("closeConfirmTabTitle(tab)");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Group strip special page tabs", () => {
|
||||
it("keeps special page tabs and their update badge in the focused group", () => {
|
||||
expect(groupTabBarSource).toContain("queryStore.focusedGroupId === props.groupId");
|
||||
expect(groupTabBarSource).toContain("data-settings-page-tab");
|
||||
expect(groupTabBarSource).toContain("data-plugin-center-tab");
|
||||
expect(groupTabBarSource).toContain("data-driver-store-tab");
|
||||
expect(groupTabBarSource).toContain("@click=\"emit('activate-settings')\"");
|
||||
expect(groupTabBarSource).toContain("@click=\"emit('activate-plugin-center')\"");
|
||||
expect(groupTabBarSource).toContain("@click=\"emit('activate-driver-store')\"");
|
||||
expect(groupTabBarSource).toContain('t("toolbar.driverManager")');
|
||||
expect(groupTabBarSource).toContain("aria-label=\"t('toolbar.updatableDriverCount')\"");
|
||||
expect(groupTabBarSource).toContain("specialPageTabs?.driverUpdateCount");
|
||||
});
|
||||
|
||||
it("routes special-page actions and preserves ordinary-tab dirty closing", () => {
|
||||
expect(groupSource).toContain(':special-page-tabs="toolbar.specialPageTabs.value"');
|
||||
expect(groupSource).toContain('@activate-settings="toolbar.activateSettingsPage()"');
|
||||
expect(groupSource).toContain('@activate-plugin-center="toolbar.activatePluginCenter()"');
|
||||
expect(groupSource).toContain('@close-plugin-center="toolbar.closePluginCenter()"');
|
||||
expect(groupSource).toContain('@close-driver-store="toolbar.closeDriverStore()"');
|
||||
expect(groupTabBarSource).toContain('@mousedown.middle.prevent="closeTab(entry.tab)"');
|
||||
expect(groupTabBarSource).toContain('@click.stop="closeTab(entry.tab)"');
|
||||
expect(groupTabBarSource).toContain("queryStore.closeTab(tab.id)");
|
||||
});
|
||||
|
||||
it("uses one presentation path for active special pages and inactive ordinary tabs", () => {
|
||||
expect(groupTabBarSource).toContain("return !specialPageActive.value && tab.id === props.activeTabId;");
|
||||
expect(groupTabBarSource).toContain("specialPageTabClass(!!specialPageTabs?.settingsActive)");
|
||||
expect(groupTabBarSource).toContain("specialPageTabClass(!!specialPageTabs?.pluginCenterActive)");
|
||||
expect(groupTabBarSource).toContain("specialPageTabClass(!!specialPageTabs?.driverStoreActive)");
|
||||
expect(groupTabBarSource).toContain("if (!active) return undefined;");
|
||||
expect(groupTabBarSource).toContain('return { "--app-tab-background": activeBackground, boxShadow: "inset 0 -2px 0 color-mix(in srgb, var(--foreground) 72%, transparent)" };');
|
||||
expect(groupTabBarSource).toContain('import "./appTabBar.css"');
|
||||
expect(groupTabBarSource).toContain("dirty-tab-marker");
|
||||
expect(groupTabBarSource).toContain("dirtyTabTitleStyle");
|
||||
expect(groupTabBarSource).toContain("createRenameDuplicateTabItems");
|
||||
});
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const contentAreaSource = readFileSync(new URL("../ContentArea.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("ContentArea data toolbar", () => {
|
||||
it("keeps table properties in the primary toolbar at every overflow tier", () => {
|
||||
expect(contentAreaSource).toContain('v-if="activeTab.result && activeDataTabTableMeta && activeTab.connectionId"');
|
||||
expect(contentAreaSource).not.toContain("showDataTableInfoButton");
|
||||
expect(contentAreaSource).not.toContain("ToolbarOverflowMenu");
|
||||
});
|
||||
});
|
||||
@@ -1,51 +0,0 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const contentAreaSource = readFileSync(new URL("../ContentArea.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("ContentArea completed query output", () => {
|
||||
it("re-evaluates the no-table fallback when tab activation resets the shared view", () => {
|
||||
expect(contentAreaSource).toContain("props.activeTab.isExecuting, props.activeOutputView] as const");
|
||||
expect(contentAreaSource).toContain('emit("update:activeOutputView", props.activeTab.id, result ? defaultViewForResult(result) : "summary")');
|
||||
});
|
||||
|
||||
it("scopes the output-view watcher to the shared result surface", () => {
|
||||
expect(contentAreaSource).toContain("if (props.editorOnly) return;");
|
||||
});
|
||||
});
|
||||
|
||||
describe("ContentArea editor-only split sizing", () => {
|
||||
it("keeps the editor pane at 100% in editor-only mode so no blank dead zone is left behind", () => {
|
||||
// The shared result surface renders results in its own workspace pane, so
|
||||
// this splitpanes has a single (editor) pane in editor-only mode. A purely
|
||||
// reactive size prop does not re-normalize a lone pane, so any value below
|
||||
// 100 would shrink the editor and leave the remainder as empty background.
|
||||
expect(contentAreaSource).toContain("const editorPaneSize = computed(() => (props.editorOnly || !resultsPaneOpen.value ? 100 : 100 - resultsPaneSize.value));");
|
||||
});
|
||||
});
|
||||
|
||||
describe("ContentArea Mongo tab reuse", () => {
|
||||
it("remounts the document browser when the active tab changes collections", () => {
|
||||
expect(contentAreaSource).toContain(':key="`${activeTab.id}:${activeTab.sql}`"');
|
||||
});
|
||||
});
|
||||
|
||||
describe("ContentArea query result grid", () => {
|
||||
it("passes connection and per-run count SQL to the query-tab grid so the total can be re-counted", () => {
|
||||
const countSqlProp = ':count-sql="activeTab.resultCountSql"';
|
||||
const countSqlIndex = contentAreaSource.indexOf(countSqlProp);
|
||||
expect(countSqlIndex).toBeGreaterThan(-1);
|
||||
// Robust string-matching: anchor on the per-run count SQL and walk back to
|
||||
// the enclosing DataGrid so the test does not depend on DataGrid ordering
|
||||
// while staying in readFileSync format.
|
||||
const dataGridIndex = contentAreaSource.lastIndexOf("<DataGrid", countSqlIndex);
|
||||
expect(dataGridIndex).toBeGreaterThan(-1);
|
||||
const queryGridBlock = contentAreaSource.slice(dataGridIndex, countSqlIndex + 900);
|
||||
expect(queryGridBlock).toContain("<DataGrid");
|
||||
expect(queryGridBlock).toContain(':connection-id="activeResultConnectionId"');
|
||||
expect(queryGridBlock).toContain(':count-sql="activeTab.resultCountSql"');
|
||||
expect(queryGridBlock).toContain(':count-total-rows="activeTab.resultCountSql ? () => queryStore.countTabResultRows(activeTab.id) : undefined"');
|
||||
expect(queryGridBlock).toContain(':total-row-count="activeTab.resultTotalRowCount"');
|
||||
expect(queryGridBlock).toContain(':total-row-count-loading="activeTab.resultTotalRowCountLoading"');
|
||||
});
|
||||
});
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
function read(relativePath: string) {
|
||||
return readFileSync(new URL(relativePath, import.meta.url), "utf8");
|
||||
}
|
||||
|
||||
// 能打开「导入表数据」向导的三个入口。侧边栏的守卫在菜单宿主(SidebarTreeRuntimeHost.vue)里,
|
||||
// 写入函数 composables/useSidebarTreeToolRuntime.ts 本身不带守卫,所以这里列的是入口界面而不是写入点。
|
||||
const TABLE_IMPORT_ENTRY_SURFACES = ["../ContentArea.vue", "../../objects/ObjectBrowser.vue", "../../sidebar/SidebarTreeRuntimeHost.vue"];
|
||||
|
||||
describe("ContentArea table import entry", () => {
|
||||
it("gates the data-tab toolbox import item on the shared capability check", () => {
|
||||
const source = read("../ContentArea.vue");
|
||||
// HANA 的能力清单是 tableImport:false。入口不跟能力走时,向导仍能打开并停在「选项」步:
|
||||
// 目标表字段元数据取不回来,下一步恒为禁用(QA #hana-import 的复现路径)。
|
||||
expect(source).toContain("const canOpenTableImport = computed(");
|
||||
expect(source).toContain("supportsTableImport(activeEffectiveDatabaseType.value)");
|
||||
|
||||
const item = source.indexOf('t("tableToolbox.importData")');
|
||||
expect(item).toBeGreaterThan(-1);
|
||||
const openTag = source.lastIndexOf("<DropdownMenuItem", item);
|
||||
expect(openTag).toBeGreaterThan(-1);
|
||||
expect(source.slice(openTag, item)).toContain('v-if="canOpenTableImport"');
|
||||
});
|
||||
|
||||
it("keeps every entry surface consulting the same capability", () => {
|
||||
for (const surface of TABLE_IMPORT_ENTRY_SURFACES) {
|
||||
expect(read(surface), surface).toContain("supportsTableImport");
|
||||
}
|
||||
});
|
||||
});
|
||||
-22
@@ -1,22 +0,0 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const contentAreaSource = readFileSync(new URL("../ContentArea.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("ContentArea restored data-tab refresh", () => {
|
||||
it("routes both no-data refresh entries through the filter-preserving helper (#7963)", () => {
|
||||
// 裸 emit("reload") 会让 onReloadData 把缺省的 whereInput/orderBy 当成
|
||||
// “用户已清空”,刷新后退回整张表的数据。
|
||||
expect(contentAreaSource).not.toContain(`@click="emit('reload')"`);
|
||||
expect(contentAreaSource).not.toMatch(/\bemit\("reload"\)\s*;/);
|
||||
expect(contentAreaSource).toContain(`@click="reloadUnavailableDataTab()"`);
|
||||
expect(contentAreaSource).toContain("reloadUnavailableDataTab();");
|
||||
});
|
||||
|
||||
it("passes the restored tab's own WHERE/ORDER BY into the reload event", () => {
|
||||
expect(contentAreaSource).toContain("const { whereInput, orderBy } = restoredDataTabReloadFilters(props.activeTab);");
|
||||
// The tabId-first contract still reserves the sql and searchText slots before
|
||||
// the restored filters. Omitting either placeholder shifts ORDER BY into WHERE.
|
||||
expect(contentAreaSource).toContain(`emit("reload", props.activeTab.id, undefined, undefined, whereInput, orderBy);`);
|
||||
});
|
||||
});
|
||||
-243
@@ -35,245 +35,8 @@ vi.mock("@/lib/backend/api", async (importOriginal) => ({
|
||||
}));
|
||||
|
||||
const specDir = dirname(fileURLToPath(import.meta.url));
|
||||
const source = readFileSync(resolve(specDir, "../EditorGroupTabBar.vue"), "utf8");
|
||||
const sharedStyles = readFileSync(resolve(specDir, "../appTabBar.css"), "utf8");
|
||||
|
||||
describe("EditorGroupTabBar semantic tab groups", () => {
|
||||
it("keeps separate collapsed state for pinned and regular clusters under the same key", () => {
|
||||
expect(source).toContain("const collapsedTabGroups = ref<Set<string>>(new Set());");
|
||||
expect(source).toContain('return `${tab.pinned ? "fixed" : "regular"}:${settingsStore.editorSettings.tabGroupMode}:${tabGroupKey(tab)}`;');
|
||||
expect(source).toContain("function toggleTabGroup(tab: QueryTab)");
|
||||
expect(source).toContain(':aria-expanded="!isTabGroupCollapsed(entry.tab)"');
|
||||
});
|
||||
|
||||
it("counts group entries in linear time instead of rescanning the section", () => {
|
||||
const builder = sourceBetween("function buildStripEntries", "const pinnedStripEntries");
|
||||
expect(builder).toContain("const groupKeys = grouping ? section.map(tabGroupKey) : [];");
|
||||
expect(builder).toContain("const groupCounts = new Map<string, number>();");
|
||||
expect(builder).toContain("groupCounts.get(groupKey!) ?? 0");
|
||||
expect(builder).not.toContain("section.filter(");
|
||||
});
|
||||
|
||||
it("computes the active group once instead of scanning every group", () => {
|
||||
const activeGroup = sourceBetween("const activeTabGroupId", "function isTabGroupActive");
|
||||
expect(activeGroup).toContain("const activeTab = props.tabs.find((item) => isTabActive(item));");
|
||||
expect(source).toContain("return activeTabGroupId.value === tabGroupId(tab);");
|
||||
});
|
||||
|
||||
it("expands a collapsed group when one of its tabs becomes active", () => {
|
||||
expect(source).toContain("expandTabGroupForTab(tabId);");
|
||||
});
|
||||
|
||||
it("supports persistent names and colors from the group header context menu", () => {
|
||||
expect(source).toContain('["#2563eb", "#d97706", "#7c3aed", "#059669", "#dc2626", "#0891b2", "#db2777", "#475569"]');
|
||||
expect(source).toContain("tabGroupCustomizations: customizations");
|
||||
expect(source).toContain("data-tab-group-name-input");
|
||||
expect(source).toContain('type="color"');
|
||||
});
|
||||
|
||||
it("keeps placement, grouping, and sorting out of the group context menu", () => {
|
||||
const groupMenu = sourceBetween("function getTabGroupMenuItems", "function openTabGroupContextMenu");
|
||||
expect(groupMenu).not.toContain("getTabPreferenceMenuItems");
|
||||
});
|
||||
|
||||
it("exposes preferences and the group close from each tab context menu", () => {
|
||||
const menuStart = source.indexOf("function getTabMenuItems");
|
||||
const menuEnd = source.indexOf("function handleTabDoubleClick");
|
||||
expect(menuStart).toBeGreaterThanOrEqual(0);
|
||||
expect(menuEnd).toBeGreaterThan(menuStart);
|
||||
const menu = source.slice(menuStart, menuEnd);
|
||||
expect(menu).not.toContain("getTabPreferenceMenuItems");
|
||||
expect(menu).toContain("action: () => closeTabGroup(tab)");
|
||||
expect(menu).toContain('visible: settingsStore.editorSettings.tabGroupMode !== "none"');
|
||||
});
|
||||
|
||||
it("closes the global semantic group by key, not just this pane's cluster", () => {
|
||||
// D1 (amended): closing a cluster is destructive and stays bar-local —
|
||||
// scoped to this pane's tabs (props.tabs), still within the trigger's
|
||||
// pinned section. Profile edits (rename/color/reset) keep global reach.
|
||||
const closeGroup = sourceBetween("function tabsInSemanticGroup", "function getTabGroupMenuItems");
|
||||
expect(closeGroup).toContain("props.tabs.filter((item) => item.pinned === tab.pinned && tabGroupKey(item) === groupKey)");
|
||||
expect(closeGroup).toContain("queryStore.closeTabsByIds(tabsToClose, finalActiveTabId)");
|
||||
});
|
||||
|
||||
it("waits for tab preference persistence and treats the whole group title as the context target", () => {
|
||||
expect(source).toContain("await settingsStore.updateEditorSettingsAndPersist(partial)");
|
||||
expect(source).toContain("openTabGroupContextMenu($event, onContextMenu)");
|
||||
expect(source).toContain("document.getSelection()?.removeAllRanges()");
|
||||
});
|
||||
|
||||
it("applies the group rail classes to clustered pills", () => {
|
||||
// Grouped pills carry tab-group-tab for the entry underline and the
|
||||
// vertical rail, with first/last markers available for side layouts.
|
||||
expect(source).toContain("'tab-group-tab': entry.grouping,");
|
||||
expect(source).toContain("'tab-group-tab--first': entry.grouping && entry.groupFirst,");
|
||||
expect(source).toContain("'tab-group-tab--last': entry.grouping && entry.groupLast,");
|
||||
expect(sharedStyles).toMatch(/\.app-tab-bar:not\(\.vertical-tab-layout\):not\(:has\(\.wrap-mode\)\) \.tab-group-tab::after\s*\{[^}]*bottom:\s*-0\.5px;/s);
|
||||
expect(sharedStyles).toContain(".app-tab-bar:not(.vertical-tab-layout) .tab-group-tab--last::after");
|
||||
expect(sharedStyles).toMatch(/\.tab-group-tab\[data-active-tab="true"\]::after,[\s\S]*?\.tab-group-entry:has\(\.tab-group-tab\[data-active-tab="true"\]\)::after\s*\{[^}]*z-index:\s*2;[^}]*var\(--foreground\) 72%/s);
|
||||
});
|
||||
|
||||
it("hides collapsed cluster pills but reveals them while searching", () => {
|
||||
expect(source).toContain("grouping && !tabSearchQuery.trim() && isTabGroupCollapsed(entry.tab)");
|
||||
expect(sharedStyles).toContain(".tab-group-entry--collapsed");
|
||||
});
|
||||
|
||||
it("remeasures overflow after a single-row group expansion finishes", () => {
|
||||
expect(source).toContain('@transitionend.self="handleTabGroupTransitionEnd"');
|
||||
expect(source).toContain(':data-tab-group-id="entry.grouping ? tabGroupId(entry.tab) : undefined"');
|
||||
expect(source).toContain("captureExpandedTabGroupWidths(new Set(pending))");
|
||||
expect(source).toContain("'tab-group-entry--collapsing'");
|
||||
expect(source).toContain("window.setTimeout(() =>");
|
||||
expect(sharedStyles).toContain("@keyframes tab-group-collapse");
|
||||
expect(sharedStyles).toMatch(/\.tab-group-entry--collapsing\s*\{[^}]*animation:\s*tab-group-collapse 140ms ease forwards;/s);
|
||||
expect(source).toContain('entry.style.removeProperty("--tab-group-entry-expanded-width")');
|
||||
expect(sharedStyles).toContain("max-width: var(--tab-group-entry-expanded-width, 100%)");
|
||||
expect(sharedStyles).toMatch(/\.tab-group-entry\[data-tab-group-id\] > \.tab-group-tab\s*\{[^}]*width:\s*var\(--tab-group-entry-expanded-width, auto\);[^}]*min-width:\s*var\(--tab-group-entry-expanded-width, max-content\) !important;[^}]*flex:\s*none;/s);
|
||||
expect(sharedStyles).toMatch(/\.app-tab-bar:not\(\.vertical-tab-layout\):not\(:has\(\.wrap-mode\)\) \.tab-group-entry\s*\{[^}]*min-width:\s*0;/s);
|
||||
const handler = sourceBetween("function handleTabGroupTransitionEnd", "function toggleTabGroup");
|
||||
expect(handler).toContain('event.propertyName !== "max-width"');
|
||||
expect(handler).toContain("refreshHorizontalTabOverflow();");
|
||||
expect(source).toContain('return "tab-tail-overflow-spacer flex-none self-stretch";');
|
||||
expect(sharedStyles).toContain(".tab-tail-overflow-spacer[data-tauri-drag-region]");
|
||||
});
|
||||
|
||||
it("keeps the overflow search scoped to the popover list without filtering the strip", () => {
|
||||
// Regression: the popover's "search opened tabs" box shared the strip's
|
||||
// query, so typing a term with no match emptied the top tab bar while the
|
||||
// active tab's content stayed on screen.
|
||||
const overflowFilter = sourceBetween("const filteredGroupTabs", "watch(tabOverflowOpen");
|
||||
expect(overflowFilter).toContain("tabOverflowSearchQuery.value.trim()");
|
||||
expect(overflowFilter).not.toContain("tabSearchQuery");
|
||||
const overflowOpenWatch = sourceBetween("watch(tabOverflowOpen", "const showOverflowControl");
|
||||
expect(overflowOpenWatch).toContain('tabOverflowSearchQuery.value = "";');
|
||||
const stripFilter = sourceBetween("const filteredPinnedTabs", "function buildStripEntries");
|
||||
expect(stripFilter).toContain("tabSearchQuery.value.trim()");
|
||||
expect(stripFilter).not.toContain("tabOverflowSearchQuery");
|
||||
expect(source).toContain('<Input v-model="tabOverflowSearchQuery" data-group-tab-search-input');
|
||||
});
|
||||
|
||||
it("keeps wrap layout out of the vertical placement", () => {
|
||||
expect(source).toContain('const isWrapLayout = computed(() => !isVerticalLayout.value && settingsStore.editorSettings.tabLayout === "wrap");');
|
||||
});
|
||||
|
||||
it("uses compact group pills and places the accent next to content for horizontal bars", () => {
|
||||
expect(source).toContain('isClassicLayout.value ? "classic-tab-layout" : "separated-tab-layout"');
|
||||
expect(source).toContain(':data-placement="settingsStore.editorSettings.tabPlacement"');
|
||||
expect(source).toContain(':data-group-mode="settingsStore.editorSettings.tabGroupMode"');
|
||||
expect(sharedStyles).toContain(".app-tab-bar:not(.vertical-tab-layout) .tab-group-header");
|
||||
expect(sharedStyles).toMatch(/\.app-tab-bar\.classic-tab-layout:not\(\.vertical-tab-layout\) \.tab-group-header-content\s*\{[^}]*height:\s*100%;[^}]*border-radius:\s*0;/s);
|
||||
expect(sharedStyles).toMatch(/\.app-tab-bar\.classic-tab-layout:not\(\.vertical-tab-layout\):not\(:has\(\.wrap-mode\)\)\[data-group-mode="none"\] \.app-tab-pill\s*\{[^}]*border-right-width:\s*0\.5px;/s);
|
||||
expect(sharedStyles).toMatch(
|
||||
/\.app-tab-bar\.classic-tab-layout:not\(\.vertical-tab-layout\):not\(:has\(\.wrap-mode\)\)\[data-placement="top"\]\[data-group-mode="none"\] \.app-tab-pill\[data-active-tab="true"\]\s*\{[^}]*border-top-color:\s*transparent;[^}]*border-right-color:\s*transparent;[^}]*border-left-color:\s*transparent;/s,
|
||||
);
|
||||
expect(sharedStyles).toMatch(/\.tab-overflow-control\s*\{[^}]*width:\s*34px;[^}]*flex:\s*0 0 34px;/s);
|
||||
expect(sharedStyles).toContain("padding-inline-end: 2.125rem;");
|
||||
expect(sharedStyles).toContain("inset-inline-end: 2.125rem;");
|
||||
expect(sharedStyles).toMatch(/\.app-tab-bar:not\(\.vertical-tab-layout\)\[data-placement="top"\] \.tab-overflow-control::before\s*\{[^}]*inset-inline:\s*-0\.25rem 0;[^}]*background:\s*transparent;/s);
|
||||
expect(sharedStyles).toMatch(/\.app-tab-scroll\.wrap-mode\.classic-wrap \.tab-group-header,[\s\S]*?\.tab-group-header-content\s*\{[^}]*height:\s*2rem !important;/s);
|
||||
expect(sharedStyles).toMatch(/\.app-tab-scroll\.wrap-mode\.classic-wrap \.tab-group-header:not\(\.tab-group-header--collapsed\)::after\s*\{[^}]*right:\s*-1px;/s);
|
||||
expect(sharedStyles).toContain(".app-tab-bar:not(.vertical-tab-layout) .tab-group-header::after");
|
||||
expect(sharedStyles).toMatch(/\.app-tab-bar:not\(\.vertical-tab-layout\) \.tab-group-header::after\s*\{[^}]*bottom:\s*0;/s);
|
||||
expect(sharedStyles).toContain(".app-tab-bar:not(.vertical-tab-layout) .tab-group-header--collapsed::after");
|
||||
expect(sharedStyles).toMatch(/\.app-tab-bar:not\(\.vertical-tab-layout\):has\(\.wrap-mode\) \.tab-group-tab::after\s*\{[^}]*bottom:\s*-0\.5px;[^}]*background:\s*var\(--tab-group-color\);/s);
|
||||
expect(sharedStyles).toMatch(/\.app-tab-bar:not\(\.vertical-tab-layout\):has\(\.wrap-mode\)\[data-placement="bottom"\] \.tab-group-tab::after\s*\{[^}]*top:\s*-0\.5px;[^}]*bottom:\s*auto;/s);
|
||||
expect(sharedStyles).toMatch(/\.app-tab-bar:not\(\.vertical-tab-layout\):not\(:has\(\.wrap-mode\)\)\[data-placement="bottom"\] \.tab-group-tab::after\s*\{[^}]*top:\s*-0\.5px;/s);
|
||||
expect(sharedStyles).toContain(".app-tab-scroll.wrap-mode.classic-wrap .tab-section--horizontal > .app-tab-pill");
|
||||
expect(sharedStyles).toContain(".app-tab-scroll.wrap-mode:not(.classic-wrap) .tab-section--horizontal > .app-tab-pill");
|
||||
expect(sharedStyles).toContain("row-gap: 0.375rem;");
|
||||
expect(sharedStyles).toContain(".app-tab-bar.separated-tab-layout:not(.vertical-tab-layout):not(:has(.wrap-mode)) .tab-group-entry:has(.tab-group-tab)");
|
||||
expect(sharedStyles).toContain('[data-group-mode="none"] .tab-section--horizontal');
|
||||
expect(sharedStyles).toContain("column-gap: 4px;");
|
||||
expect(sharedStyles).toContain(".app-tab-bar.separated-tab-layout.horizontal-fixed-tabs .app-tab-scroll:not(.wrap-mode)");
|
||||
expect(sharedStyles).toContain(".horizontal-fixed-tabs-scroll.wrap-mode");
|
||||
expect(sharedStyles).toContain("row-gap: 0.375rem !important;");
|
||||
expect(sharedStyles).toMatch(/\.horizontal-fixed-tabs-scroll\.wrap-mode\.classic-wrap\s*\{[^}]*row-gap:\s*0\.25rem !important;/s);
|
||||
expect(sharedStyles).toMatch(/\.app-tab-bar\.classic-tab-layout:not\(\.vertical-tab-layout\):not\(:has\(\.wrap-mode\)\) \.tab-group-entry\s*\{[^}]*height:\s*100%;[^}]*max-height:\s*none;/s);
|
||||
expect(sharedStyles).toMatch(/\.app-tab-bar:not\(\.vertical-tab-layout\):has\(\.wrap-mode\) \.tab-group-entry:has\(\.tab-group-tab\)::after\s*\{[^}]*bottom:\s*0;/s);
|
||||
expect(sharedStyles).toMatch(/\.app-tab-bar\.classic-tab-layout:not\(\.vertical-tab-layout\):not\(:has\(\.wrap-mode\)\)\[data-placement="top"\] \.app-tab-pill\s*\{[^}]*border-top-width:\s*0;/s);
|
||||
expect(sharedStyles).toContain("scroll-margin-inline-end: 1px;");
|
||||
});
|
||||
|
||||
function sourceBetween(start: string, end: string): string {
|
||||
const startIndex = source.indexOf(start);
|
||||
const endIndex = source.indexOf(end, startIndex + start.length);
|
||||
expect(startIndex).toBeGreaterThanOrEqual(0);
|
||||
expect(endIndex).toBeGreaterThan(startIndex);
|
||||
return source.slice(startIndex, endIndex);
|
||||
}
|
||||
});
|
||||
|
||||
describe("EditorGroupTabBar vertical placement", () => {
|
||||
const groupSource = readFileSync(resolve(specDir, "../EditorGroup.vue"), "utf8");
|
||||
const workspaceSource = readFileSync(resolve(specDir, "../SqlEditorWorkspace.vue"), "utf8");
|
||||
const appSource = readFileSync(resolve(dirname(fileURLToPath(import.meta.url)), "../../../App.vue"), "utf8");
|
||||
|
||||
it("renders each pane's own bar as a vertical strip when placement is left/right", () => {
|
||||
expect(source).toContain('const isVerticalLayout = computed(() => settingsStore.editorSettings.tabPlacement === "left" || settingsStore.editorSettings.tabPlacement === "right");');
|
||||
expect(source).toContain('isVerticalLayout.value && props.tabBarCollapsed ? "vertical-tab-layout--collapsed" : ""');
|
||||
// The strip flips to a column with vertical scrolling; no horizontal strip remains.
|
||||
expect(source).toContain("isVerticalLayout ? 'flex-col items-stretch overflow-y-auto overflow-x-hidden py-1'");
|
||||
});
|
||||
|
||||
it("keeps vertical rows fixed and aligns the sidebar toolbar with content headers", () => {
|
||||
expect(sharedStyles).toMatch(/\.vertical-tab-layout\s*\{[^}]*--tab-group-root-rail-x:\s*1\.16rem;[^}]*--tab-group-tab-inset:\s*1\.8rem;[^}]*--tab-group-branch-width:\s*0\.5rem;/s);
|
||||
expect(sharedStyles).toContain("width: calc(100% - var(--tab-group-tab-inset) - 0.25rem);");
|
||||
expect(sharedStyles).toContain("margin-inline: var(--tab-group-tab-inset) 0.25rem;");
|
||||
expect(sharedStyles).toContain("padding-inline: 0.2rem 0.25rem !important;");
|
||||
expect(sharedStyles).toMatch(/\.vertical-tab-layout \.tab-group-entry\s*\{[^}]*flex:\s*none;/s);
|
||||
expect(sharedStyles).toMatch(/\.vertical-tab-layout \.app-tab-scroll\s*\{[^}]*overflow-x:\s*hidden;/s);
|
||||
expect(sharedStyles).toMatch(/\.vertical-tab-layout \.app-tab-pill\s*\{[^}]*border-radius:\s*var\(--dbx-radius-md\);/s);
|
||||
expect(sharedStyles).toMatch(/\.vertical-tab-layout \.tab-group-entry\s*\{[^}]*max-height:\s*2rem;/s);
|
||||
expect(sharedStyles).toContain("max-height 140ms ease,");
|
||||
expect(sharedStyles).toMatch(/\.vertical-tab-layout \.tab-group-entry--collapsed\s*\{[^}]*max-height:\s*0;[^}]*opacity:\s*0;/s);
|
||||
expect(sharedStyles).toMatch(/\.vertical-tab-layout--collapsed \.tab-group-entry\s*\{[^}]*max-height:\s*2\.5rem;[^}]*overflow:\s*visible;/s);
|
||||
expect(sharedStyles).toMatch(/\.vertical-tab-layout--collapsed \.tab-group-entry--collapsed\s*\{[^}]*max-height:\s*0;[^}]*overflow:\s*hidden;/s);
|
||||
expect(source).toContain("if (isWrapLayout.value || isVerticalLayout.value) return;");
|
||||
expect(source).toContain("if (isWrapLayout.value) {");
|
||||
expect(source).toContain('inline: isVerticalLayout.value ? "nearest" : "center"');
|
||||
expect(source).toContain('class="flex h-9 shrink-0 items-center gap-0.5 border-b p-1"');
|
||||
expect(source).toContain('class="h-7 w-full pl-7 text-sm"');
|
||||
});
|
||||
|
||||
it("positions each pane's bar by the global placement without mixing directions", () => {
|
||||
expect(groupSource).toContain('case "bottom":');
|
||||
expect(groupSource).toContain('return "flex-col-reverse";');
|
||||
expect(groupSource).toContain('case "left":');
|
||||
expect(groupSource).toContain('return "flex-row";');
|
||||
expect(groupSource).toContain('case "right":');
|
||||
expect(groupSource).toContain('return "flex-row-reverse";');
|
||||
// The editor toolbar stays atop the pane's content column in every placement.
|
||||
expect(groupSource).toContain('class="flex min-h-0 min-w-0 flex-1 flex-col"');
|
||||
});
|
||||
|
||||
it("shares the vertical width/collapse state from App through the pane chain", () => {
|
||||
expect(appSource).toContain(':tab-bar-width="tabBarWidth"');
|
||||
expect(appSource).toContain(':tab-bar-collapsed="tabBarCollapsed"');
|
||||
expect(appSource).toContain('@start-resize="startTabBarResize"');
|
||||
expect(appSource).toContain('@toggle-collapse="toggleTabBarCollapsed"');
|
||||
expect(workspaceSource).toContain(':tab-bar-width="tabBarWidth"');
|
||||
expect(workspaceSource).toContain("@start-resize=\"emit('start-resize', $event)\"");
|
||||
expect(groupSource).toContain(':tab-bar-width="tabBarWidth"');
|
||||
// Dragging any pane's handle drives the shared resize handler.
|
||||
expect(source).toContain("@pointerdown=\"emit('start-resize', $event)\"");
|
||||
expect(source).toContain("@click=\"emit('toggle-collapse')\"");
|
||||
});
|
||||
|
||||
it("keeps horizontal placements immune to the persisted collapse state", () => {
|
||||
expect(source).toContain("const isTabBarCollapsed = computed(() => isVerticalLayout.value && !!props.tabBarCollapsed);");
|
||||
expect(source).toContain("if (!isVerticalLayout.value) return undefined;");
|
||||
});
|
||||
|
||||
it("uses the sidebar rail and soft active shadow for vertical pills", () => {
|
||||
expect(sharedStyles).toContain(".vertical-tab-layout .tab-group-tab::before");
|
||||
expect(sharedStyles).toMatch(/\.vertical-tab-layout \.tab-group-tab::before\s*\{[^}]*top:\s*-0\.25rem;[^}]*bottom:\s*-0\.25rem;/s);
|
||||
expect(sharedStyles).toContain('.vertical-tab-layout .app-tab-pill[data-active-tab="true"]');
|
||||
expect(sharedStyles).toContain("inset 0 0 0 1px color-mix");
|
||||
expect(sharedStyles).toContain(".vertical-tab-layout .tab-group-header:not(.tab-group-header--collapsed)::after");
|
||||
expect(sharedStyles).toContain("margin-inline: var(--tab-group-tab-inset) 0.25rem;");
|
||||
});
|
||||
});
|
||||
|
||||
function createHost(): HTMLDivElement {
|
||||
const host = document.createElement("div");
|
||||
document.body.appendChild(host);
|
||||
@@ -738,12 +501,6 @@ describe("EditorGroupTabBar group behavior", () => {
|
||||
const pill = host.querySelector<HTMLElement>(`[data-tab-id="${pluginTabId}"]`);
|
||||
expect(pill).toBeTruthy();
|
||||
expect(pill!.querySelector("img")).toBeTruthy();
|
||||
// The pill and the overflow popup list both render via TabModeIcon, whose
|
||||
// per-mode chain must keep the plugin-workbench plugin icon branch.
|
||||
const tabModeIconSource = readFileSync(resolve(specDir, "../TabModeIcon.vue"), "utf8");
|
||||
expect(tabModeIconSource).toContain("tab.mode === 'plugin-workbench' && tab.pluginWorkbench");
|
||||
expect(tabModeIconSource).toContain(':contribution-id="tab.pluginWorkbench.contributionId"');
|
||||
expect(source).toContain('<TabModeIcon :tab="entry.tab"');
|
||||
|
||||
app.unmount();
|
||||
host.remove();
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const source = readFileSync(new URL("../EditorGroupTabBar.vue", import.meta.url), "utf8");
|
||||
const tabMenuSource = readFileSync(new URL("../../../lib/tabs/tabMenu.ts", import.meta.url), "utf8");
|
||||
|
||||
describe("EditorGroupTabBar compatibility with AppTabBar", () => {
|
||||
it("keeps data-tab double-click Zen mode behavior", () => {
|
||||
expect(source).toContain('"toggle-zen-mode": []');
|
||||
expect(source).toContain('tab.mode === "data"');
|
||||
expect(source).toContain('emit("toggle-zen-mode")');
|
||||
expect(source).toContain("if (tab.id !== props.activeTabId) {");
|
||||
expect(source).toContain("startRenameTab(tab);");
|
||||
});
|
||||
|
||||
it("only offers Duplicate for query tabs", () => {
|
||||
expect(tabMenuSource).toContain("visible: options.canRename");
|
||||
expect(source).toContain("createRenameDuplicateTabItems");
|
||||
});
|
||||
|
||||
it("does not double-activate from the tab item click", () => {
|
||||
expect(source).toContain("function activateTab(tabId: string) {");
|
||||
expect(source).toContain('emit("activate-tab", tabId);');
|
||||
expect(source).not.toContain("queryStore.activateTabInGroup(props.groupId, tabId);");
|
||||
});
|
||||
|
||||
it("cleans up drag listeners on cancel, blur, and unmount", () => {
|
||||
expect(source).toContain("function cleanupTabDrag(event?: Event)");
|
||||
expect(source).toContain('window.addEventListener("pointercancel", cleanupTabDrag)');
|
||||
expect(source).toContain('window.addEventListener("blur", cleanupTabDrag)');
|
||||
expect(source).toContain("onUnmounted(() => {");
|
||||
expect(source).toContain("cleanupTabDrag();");
|
||||
});
|
||||
|
||||
it("validates drag source and target groups before moving", () => {
|
||||
expect(source).toContain("serializeTabDragPayload");
|
||||
expect(source).toContain("parseTabDragPayload");
|
||||
expect(source).toContain("const sourceGroupExists = queryStore.groups.some((group) => group.id === payload.sourceGroupId)");
|
||||
expect(source).toContain("const targetGroupExists = queryStore.groups.some((group) => group.id === targetGroupId)");
|
||||
expect(source).toContain("if (!sourceGroupExists || !targetGroupExists) {");
|
||||
});
|
||||
|
||||
it("keeps pinned tabs in a separate row for horizontal placements", () => {
|
||||
expect(source).toContain('hasHorizontalFixedRows.value ? "horizontal-fixed-tabs" : ""');
|
||||
expect(source).toContain("horizontal-fixed-tabs-scroll");
|
||||
expect(source).toContain("const stripSections = computed(() =>");
|
||||
expect(source).toContain('{ key: "regular", pinned: false, entries: regularStripEntries.value }');
|
||||
expect(source).toContain('{ key: "fixed", pinned: true, entries: pinnedStripEntries.value }');
|
||||
expect(source).toContain("!isVerticalLayout.value && props.tabs.some((tab) => tab.pinned)");
|
||||
});
|
||||
});
|
||||
@@ -1,71 +0,0 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const panelSource = readFileSync(new URL("../SqlFilePanel.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("SqlFilePanel selection", () => {
|
||||
it("uses the shared ordered-list selection behavior", () => {
|
||||
expect(panelSource).toContain("orderedListSelectionIntent(event)");
|
||||
expect(panelSource).toContain("orderedListRangeAnchorIndex(visibleItems.value");
|
||||
expect(panelSource).not.toContain("anchorIndex ?? 0");
|
||||
});
|
||||
|
||||
it("does not open or expand rows during modifier selection", () => {
|
||||
expect(panelSource).toMatch(/if \(selectionIntent === "range"\)[\s\S]*selectRangeTo\(currentIndex\);[\s\S]*return;/);
|
||||
expect(panelSource).toMatch(/if \(selectionIntent === "toggle"\)[\s\S]*selectionAnchorIndex\.value = currentIndex;[\s\S]*return;/);
|
||||
expect(panelSource).toMatch(/selectionAnchorIndex\.value = currentIndex;[\s\S]*activate\(\);/);
|
||||
});
|
||||
|
||||
it("clears selection when a non-row area is clicked", () => {
|
||||
expect(panelSource).toContain('@click="handlePanelClick"');
|
||||
expect(panelSource).toContain("[data-sql-file-row='true']");
|
||||
expect(panelSource).toContain('data-sql-file-row="true"');
|
||||
});
|
||||
});
|
||||
|
||||
describe("SqlFilePanel folder headers", () => {
|
||||
it("keeps sticky folder headers opaque while the file list scrolls", () => {
|
||||
expect(panelSource).toContain("bg-[color-mix(in_oklab,var(--muted)_10%,var(--background))] sticky top-0");
|
||||
expect(panelSource).toContain("hover:bg-[color-mix(in_oklab,var(--accent)_40%,var(--background))]");
|
||||
expect(panelSource).not.toContain("bg-muted/10 sticky top-0");
|
||||
});
|
||||
});
|
||||
|
||||
describe("SqlFilePanel file renaming", () => {
|
||||
it("does not re-read a successfully renamed file before refreshing the tree", () => {
|
||||
const renameFunction = panelSource.match(/async function renameSqlFile\(\) \{[\s\S]*?\n\}/)?.[0];
|
||||
|
||||
expect(renameFunction).toBeDefined();
|
||||
expect(renameFunction).toContain("queryStore.relocateExternalSqlFilePath(target.entry.path, nextPath)");
|
||||
expect(renameFunction).not.toContain("readExternalSqlFileSnapshot(nextPath)");
|
||||
});
|
||||
|
||||
it("preserves non-SQL extensions while keeping SQL rename convenience", () => {
|
||||
expect(panelSource).toContain("normalizedRenamedFileName(fileNameInput.value, target.entry.name)");
|
||||
expect(panelSource).toContain("isSqlFilePath(currentName) ? normalizedSqlFileName(trimmed) : trimmed");
|
||||
});
|
||||
});
|
||||
|
||||
describe("SqlFilePanel directory actions", () => {
|
||||
it("shows a new SQL file icon for nested directories", () => {
|
||||
expect(panelSource).toContain('@click.stop="openCreateDialog(folder.path, entry.path)"');
|
||||
});
|
||||
});
|
||||
|
||||
describe("SqlFilePanel file filter", () => {
|
||||
it("restores the previous filter when the backend rejects the saved pattern", () => {
|
||||
expect(panelSource).toContain('message?.startsWith("Invalid file filter")');
|
||||
expect(panelSource).toContain("saveSqlFileFilter(previousFilter)");
|
||||
expect(panelSource).toContain('t("sqlFileTree.filterInvalid"');
|
||||
});
|
||||
|
||||
it("renders the translated filter placeholder", () => {
|
||||
expect(panelSource).toContain("t('sqlFileTree.fileFilterPlaceholder')");
|
||||
expect(panelSource).not.toContain("const fileFilterPlaceholder =");
|
||||
});
|
||||
|
||||
it("offers SQL execution only for SQL files", () => {
|
||||
expect(panelSource).toContain("if (isSqlFilePath(target.entry.name))");
|
||||
expect(panelSource).toContain("isExternalSqlFileTooLargeError(e) && isSqlFilePath(path)");
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,5 @@
|
||||
// @vitest-environment happy-dom
|
||||
import { createApp, h } from "vue";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import ToolbarUpdateIcon from "../ToolbarUpdateIcon.vue";
|
||||
describe("silent toolbar update icon", () => {
|
||||
@@ -13,29 +11,4 @@ describe("silent toolbar update icon", () => {
|
||||
expect(container.querySelector("[data-toolbar-update-progress], [data-toolbar-update-scan]")).toBeNull();
|
||||
app.unmount();
|
||||
});
|
||||
|
||||
it("renders a text Update action whenever any aggregate update is available", () => {
|
||||
const source = readFileSync(resolve(process.cwd(), "apps/desktop/src/components/layout/AppToolbar.vue"), "utf8");
|
||||
|
||||
expect(source).toContain('v-if="hasUpdateAvailable"');
|
||||
expect(source).toContain("data-toolbar-update-action");
|
||||
expect(source).toContain('t("updates.updateAction")');
|
||||
});
|
||||
|
||||
it("keeps the update entry visible when the appearance setting is off but an update is available", () => {
|
||||
const source = readFileSync(resolve(process.cwd(), "apps/desktop/src/components/layout/AppToolbar.vue"), "utf8");
|
||||
|
||||
expect(source).toContain("const showToolbarUpdateEntry = computed(() => toolbarItems.value.checkUpdates || props.hasUpdateAvailable);");
|
||||
expect(source).toContain("if (showToolbarUpdateEntry.value) {");
|
||||
expect(source).toContain('<template v-if="showToolbarUpdateEntry">');
|
||||
expect(source).not.toContain('<template v-if="toolbarItems.checkUpdates">');
|
||||
});
|
||||
|
||||
it("passes only opt-out component badges to their separate toolbar entries", () => {
|
||||
const source = readFileSync(resolve(process.cwd(), "apps/desktop/src/App.vue"), "utf8");
|
||||
|
||||
expect(source).toContain(':agent-driver-update-count="showDriverStoreUpdateBadge"');
|
||||
expect(source).toContain(':has-mcp-update-available="showMcpSettingsUpdateBadge"');
|
||||
expect(source).not.toContain(':agent-driver-update-count="toolbarDriverUpdateCount"');
|
||||
});
|
||||
});
|
||||
-48
@@ -1,48 +0,0 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const appSource = readFileSync(new URL("../../../App.vue", import.meta.url), "utf8");
|
||||
|
||||
// The editor-content wrapper carries a v-show guard that hides it while the
|
||||
// settings page or driver store is the active surface. A past merge resolved
|
||||
// this region by nesting the special surfaces INSIDE that guarded wrapper,
|
||||
// which display:none-d the settings page exactly when it was active. These
|
||||
// assertions pin the sibling order so a future merge cannot re-introduce it.
|
||||
describe("App main content surface structure", () => {
|
||||
it("hides only the editor workspace via the surface guard, never the special pages", () => {
|
||||
const guard = 'v-show="!driverStoreActive && !pluginCenterActive && !settingsStore.settingsPageActive"';
|
||||
// The empty-state slot shares the query surface's visibility guard.
|
||||
expect(appSource.split(guard).length - 1).toBe(1);
|
||||
|
||||
// Source order: special surfaces first, then the guarded editor wrapper.
|
||||
const markers = ["<DriverStorePage", "<EditorSettingsPage", guard, "<SqlEditorWorkspace", "<WelcomeScreen"];
|
||||
const indices = markers.map((marker) => appSource.indexOf(marker));
|
||||
expect(indices.every((index) => index >= 0)).toBe(true);
|
||||
expect([...indices].sort((a, b) => a - b)).toEqual(indices);
|
||||
});
|
||||
|
||||
it("keeps navigation independent from the workspace welcome content", () => {
|
||||
expect(appSource).toContain(':show-tab-navigation="queryStore.tabs.length > 0 || settingsPageTabOpen || driverStoreTabOpen || pluginCenterTabOpen"');
|
||||
expect(appSource).toContain(':active-tab="activeTab ?? undefined"');
|
||||
expect(appSource).toMatch(/<template #empty>\s*<WelcomeScreen/);
|
||||
expect(appSource).not.toContain('v-if="queryStore.tabs.length > 0 || settingsPageTabOpen || driverStoreTabOpen || pluginCenterTabOpen"');
|
||||
});
|
||||
|
||||
it("returns to an open special page after the final query tab closes", () => {
|
||||
expect(appSource).toContain("else if (previousId) activateOpenSpecialPageFallback();");
|
||||
expect(appSource).toMatch(
|
||||
/function activateOpenSpecialPageFallback\(\)[\s\S]*?settingsPageTabOpen\.value[\s\S]*?activateMainContentSurface\("settings"\)[\s\S]*?driverStoreTabOpen\.value[\s\S]*?activateMainContentSurface\("driverStore"\)[\s\S]*?pluginCenterTabOpen\.value[\s\S]*?activateMainContentSurface\("pluginCenter"\)/,
|
||||
);
|
||||
});
|
||||
|
||||
it("anchors the drag-back hit test on every pane strip and the special-surfaces bar", () => {
|
||||
const groupBarSource = readFileSync(new URL("../EditorGroupTabBar.vue", import.meta.url), "utf8");
|
||||
const slimBarSource = readFileSync(new URL("../AppTabBar.vue", import.meta.url), "utf8");
|
||||
expect(groupBarSource).toContain("data-main-tab-bar");
|
||||
expect(groupBarSource).toContain("'ring-2 ring-primary ring-inset': detachedDropTarget");
|
||||
expect(slimBarSource).toContain("data-special-page-tab-target");
|
||||
expect(slimBarSource).not.toContain("data-return-tab");
|
||||
// The split workspace renders several bars; the hit test must union their rects.
|
||||
expect(appSource).toContain('querySelectorAll<HTMLElement>("[data-main-tab-bar]")');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user