fix(sidebar): show group action without connections

This commit is contained in:
t8y2 2026-05-18 19:23:55 +08:00
parent e9fd89ad16
commit f7f622229b
2 changed files with 17 additions and 1 deletions

View File

@ -182,7 +182,7 @@ defineExpose({ focusSearch });
<template>
<div class="h-full min-h-0 flex flex-col text-sm select-none">
<div v-if="store.treeNodes.length > 0" class="sticky top-0 z-10 bg-background px-2 py-1">
<div class="sticky top-0 z-10 bg-background px-2 py-1">
<div class="relative flex items-center gap-1">
<div class="relative flex-1">
<Search class="absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground" />

View File

@ -0,0 +1,16 @@
import test from "node:test";
import assert from "node:assert/strict";
import { readFileSync } from "node:fs";
const connectionTreeSource = readFileSync(
new URL("../../apps/desktop/src/components/sidebar/ConnectionTree.vue", import.meta.url),
"utf8",
);
test("connection tree toolbar is visible before any connection exists", () => {
assert.ok(connectionTreeSource.includes(":title=\"t('connectionGroup.createGroup')\""));
assert.ok(
!connectionTreeSource.includes('v-if="store.treeNodes.length > 0" class="sticky'),
"the toolbar should not be hidden when the connection tree is empty",
);
});