feat(sql-file): explain SQL file storage source in panel
This commit is contained in:
15 files changed
+139
No files matched your search
@@ -7,6 +7,7 @@ import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";
|
||||
import LightTooltip from "@/components/ui/LightTooltip.vue";
|
||||
import HelpTooltip from "@/components/ui/tooltip/HelpTooltip.vue";
|
||||
import CustomContextMenu, { type ContextMenuItem } from "@/components/ui/CustomContextMenu.vue";
|
||||
import { useQueryStore } from "@/stores/queryStore";
|
||||
import { useConnectionStore } from "@/stores/connectionStore";
|
||||
@@ -542,6 +543,9 @@ function clearContextTarget() {
|
||||
<div class="h-full flex flex-col overflow-hidden">
|
||||
<div class="h-9 flex items-center gap-1 px-2 border-b shrink-0 bg-muted/20">
|
||||
<span class="text-[13px] font-medium">{{ t("sqlFileTree.title") }}</span>
|
||||
<HelpTooltip :label="t('sqlFileTree.storageHelp')" side="bottom" :side-offset="4" trigger-class="h-4 w-4" content-class="max-w-[320px] whitespace-pre-line">
|
||||
{{ t("sqlFileTree.storageHelp") }}
|
||||
</HelpTooltip>
|
||||
<span class="flex-1" />
|
||||
<LightTooltip :text="t('sqlFileTree.filterSettings')" side="bottom" :delay="0" :close-delay="0" nowrap>
|
||||
<Button
|
||||
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
// @vitest-environment happy-dom
|
||||
|
||||
import { createApp, nextTick, type App } from "vue";
|
||||
import { createPinia, setActivePinia } from "pinia";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import i18n from "@/i18n";
|
||||
|
||||
vi.mock("@/lib/sqlFile/sqlFileFolders", () => ({
|
||||
getSqlFileFilter: () => "",
|
||||
getSqlFileFolderPaths: () => [],
|
||||
saveSqlFileFilter: vi.fn(),
|
||||
saveSqlFileFolderPaths: vi.fn(),
|
||||
notifySqlFileFoldersChanged: vi.fn(),
|
||||
}));
|
||||
vi.mock("@/lib/backend/tauriRuntime", () => ({ isTauriRuntime: () => false }));
|
||||
|
||||
import SqlFilePanel from "../SqlFilePanel.vue";
|
||||
|
||||
const mounted: Array<{ app: App; host: HTMLElement }> = [];
|
||||
|
||||
function mountPanel() {
|
||||
setActivePinia(createPinia());
|
||||
const host = document.createElement("div");
|
||||
document.body.appendChild(host);
|
||||
const app = createApp(SqlFilePanel);
|
||||
app.use(i18n);
|
||||
app.mount(host);
|
||||
mounted.push({ app, host });
|
||||
return host;
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
for (const { app, host } of mounted.splice(0)) {
|
||||
app.unmount();
|
||||
host.remove();
|
||||
}
|
||||
});
|
||||
|
||||
describe("SQL file panel storage help", () => {
|
||||
it("shows a help button next to the title", async () => {
|
||||
const host = mountPanel();
|
||||
await nextTick();
|
||||
|
||||
const header = host.querySelector(".h-9");
|
||||
expect(header).not.toBeNull();
|
||||
|
||||
const label = i18n.global.t("sqlFileTree.storageHelp");
|
||||
const helpButton = header!.querySelector<HTMLButtonElement>(`button[aria-label="${label}"]`);
|
||||
expect(helpButton).not.toBeNull();
|
||||
expect(helpButton!.querySelector("svg")).not.toBeNull();
|
||||
});
|
||||
|
||||
it("keeps the help button directly after the panel title", async () => {
|
||||
const host = mountPanel();
|
||||
await nextTick();
|
||||
|
||||
const header = host.querySelector(".h-9")!;
|
||||
const title = header.querySelector("span");
|
||||
expect(title?.textContent?.trim()).toBe(i18n.global.t("sqlFileTree.title"));
|
||||
const helpButton = title?.nextElementSibling?.querySelector<HTMLButtonElement>("button[aria-label]");
|
||||
expect(helpButton?.getAttribute("aria-label")).toBe(i18n.global.t("sqlFileTree.storageHelp"));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user