fix(ai): restore progressive composer controls

This commit is contained in:
t8y2 committed 2026-09-29 11:05:09 +08:00
1 parent 3c82cc21a0
commit 62bf47a0e9
2 files changed
+221 -58

No files matched your search

@@ -3,7 +3,7 @@ import { computed, defineAsyncComponent, h, nextTick, onMounted, onUnmounted, re
import { uuid } from "@/lib/common/utils"; import { uuid } from "@/lib/common/utils";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { translateBackendError } from "@/i18n/backend-errors"; import { translateBackendError } from "@/i18n/backend-errors";
import { deferUntilPanelResizeEnd } from "@/lib/app/panelResizeState"; import { deferUntilPanelResizeEnd, isPanelResizing } from "@/lib/app/panelResizeState";
import { import {
ArrowDown, ArrowDown,
ArrowUp, ArrowUp,
@@ -1228,19 +1228,27 @@ const pendingCompaction = ref<{ summary: string; compactedMessages: number } | n
const AI_TEXTAREA_MIN_HEIGHT_PX = 64; const AI_TEXTAREA_MIN_HEIGHT_PX = 64;
const AI_TEXTAREA_MAX_PANEL_RATIO = 0.5; const AI_TEXTAREA_MAX_PANEL_RATIO = 0.5;
const AI_TEXTAREA_HEIGHT_STORAGE_KEY = "dbx-ai-textarea-height"; const AI_TEXTAREA_HEIGHT_STORAGE_KEY = "dbx-ai-textarea-height";
const AI_RESPONSIVE_DRAG_MEASURE_STEP_PX = 16;
const textareaHeight = ref<number>(AI_TEXTAREA_MIN_HEIGHT_PX); const textareaHeight = ref<number>(AI_TEXTAREA_MIN_HEIGHT_PX);
const assistantRootRef = ref<HTMLElement | null>(null); const assistantRootRef = ref<HTMLElement | null>(null);
const promptPanelRef = ref<HTMLElement | null>(null); const promptPanelRef = ref<HTMLElement | null>(null);
const compactContextControls = ref(false); const compactContextControls = ref(false);
const compactActionControls = ref(false); const compactModelControl = ref(false);
const compactModeActionControl = ref(false);
const isResizing = ref<boolean>(false); const isResizing = ref<boolean>(false);
let resizeStartY = 0; let resizeStartY = 0;
let resizeStartHeight = 0; let resizeStartHeight = 0;
let promptPanelResizeObserver: ResizeObserver | undefined; let promptPanelResizeObserver: ResizeObserver | undefined;
let responsiveControlMeasureFrame: number | null = null; let responsiveControlMeasureFrame: number | null = null;
let responsiveControlMeasureForce = false; let responsiveControlMeasureForce = false;
let responsiveControlObservedWidth: number | null = null;
let lastResponsiveControlWidth: number | null = null; let lastResponsiveControlWidth: number | null = null;
let latestResponsiveControlDragWidth: number | null = null;
let lastResponsiveControlDragMeasureWidth: number | null = null;
let responsiveControlDragMeasureRunning = false;
let responsiveControlDragMeasureQueued = false;
let responsiveControlDragEpoch = 0;
interface AiTableMentionCandidate { interface AiTableMentionCandidate {
kind: "table"; kind: "table";
@@ -5130,11 +5138,11 @@ onMounted(async () => {
appearance: () => aiCodeAppearance.value, appearance: () => aiCodeAppearance.value,
}).catch(() => undefined); }).catch(() => undefined);
window.addEventListener("resize", handlePanelResize); window.addEventListener("resize", handleWindowResize);
document.addEventListener("dbx:tauri-file-drop", onTauriFileDrop as EventListener); document.addEventListener("dbx:tauri-file-drop", onTauriFileDrop as EventListener);
window.addEventListener(DBX_TABLE_REFERENCE_DROP_EVENT, onTableReferenceDropEvent); window.addEventListener(DBX_TABLE_REFERENCE_DROP_EVENT, onTableReferenceDropEvent);
if (typeof ResizeObserver !== "undefined" && assistantRootRef.value) { if (typeof ResizeObserver !== "undefined" && assistantRootRef.value) {
promptPanelResizeObserver = new ResizeObserver(handlePanelResize); promptPanelResizeObserver = new ResizeObserver(handleObservedPanelResize);
promptPanelResizeObserver.observe(assistantRootRef.value); promptPanelResizeObserver.observe(assistantRootRef.value);
if (promptPanelRef.value) promptPanelResizeObserver.observe(promptPanelRef.value); if (promptPanelRef.value) promptPanelResizeObserver.observe(promptPanelRef.value);
} }
@@ -5153,9 +5161,24 @@ function clampTextareaHeight(height: number) {
return Math.max(AI_TEXTAREA_MIN_HEIGHT_PX, Math.min(maxTextareaHeight(), Math.round(height))); return Math.max(AI_TEXTAREA_MIN_HEIGHT_PX, Math.min(maxTextareaHeight(), Math.round(height)));
} }
function handlePanelResize() { function handleWindowResize() {
handlePanelResize();
}
function handleObservedPanelResize(entries: ResizeObserverEntry[]) {
const promptPanel = promptPanelRef.value;
const promptPanelEntry = promptPanel ? entries.find((entry) => entry.target === promptPanel) : undefined;
handlePanelResize(promptPanelEntry?.contentRect.width);
}
function handlePanelResize(observedPanelWidth?: number) {
if (isPanelResizing.value) {
deferUntilPanelResizeEnd(resyncPromptPanelAfterPanelResize);
if (typeof observedPanelWidth === "number") scheduleResponsiveControlDragMeasurement(observedPanelWidth);
return;
}
textareaHeight.value = clampTextareaHeight(textareaHeight.value); textareaHeight.value = clampTextareaHeight(textareaHeight.value);
scheduleResponsiveControlMeasurement(); scheduleResponsiveControlMeasurement(false, observedPanelWidth);
} }
function hasHorizontalOverflow(element: HTMLElement | null): boolean { function hasHorizontalOverflow(element: HTMLElement | null): boolean {
@@ -5167,48 +5190,99 @@ function hasOverflowingLabel(element: HTMLElement | null, selector: string): boo
return Array.from(element.querySelectorAll<HTMLElement>(selector)).some((label) => label.scrollWidth > label.clientWidth + 1); return Array.from(element.querySelectorAll<HTMLElement>(selector)).some((label) => label.scrollWidth > label.clientWidth + 1);
} }
async function measureResponsiveControls(force = false) { function actionControlsOverflow(actionRow: HTMLElement | null): boolean {
const panel = promptPanelRef.value; return hasHorizontalOverflow(actionRow) || hasOverflowingLabel(actionRow, ".ai-mode-action-label, .ai-model-selector-label, .ai-prompt-queue-label");
if (!panel) return; }
// Reading clientWidth/scrollWidth here forces a document-wide synchronous
// relayout, and the AI panel divider drag fires resize events every frame. function resyncPromptPanelAfterPanelResize() {
// Skip measurements while the drag is in flight and re-measure once at the end. responsiveControlDragEpoch += 1;
if ( latestResponsiveControlDragWidth = null;
deferUntilPanelResizeEnd(() => { lastResponsiveControlDragMeasureWidth = null;
void measureResponsiveControls(force); responsiveControlDragMeasureQueued = false;
}) if (!assistantViewMounted) return;
) textareaHeight.value = clampTextareaHeight(textareaHeight.value);
return; scheduleResponsiveControlMeasurement(true);
const panelWidth = panel.clientWidth; }
async function applyResponsiveControlMeasurement(panel: HTMLElement, panelWidth: number, force: boolean, panelResizeEpoch?: number) {
if (!force && lastResponsiveControlWidth === panelWidth) return; if (!force && lastResponsiveControlWidth === panelWidth) return;
// Measure the full labels before deciding to compact. This lets a wide if (compactContextControls.value || compactModelControl.value || compactModeActionControl.value) {
// composer recover from icon mode after it grows, while the actual
// overflow checks decide independently for the context and action rows.
if (compactContextControls.value || compactActionControls.value) {
compactContextControls.value = false; compactContextControls.value = false;
compactActionControls.value = false; compactModelControl.value = false;
compactModeActionControl.value = false;
await nextTick(); await nextTick();
if (panelResizeEpoch !== undefined && (!isPanelResizing.value || panelResizeEpoch !== responsiveControlDragEpoch)) return;
} }
const contextRow = panel.querySelector<HTMLElement>("[data-ai-composer-context-row]"); const contextRow = panel.querySelector<HTMLElement>("[data-ai-composer-context-row]");
const actionRow = panel.querySelector<HTMLElement>("[data-ai-composer-actions]"); const actionRow = panel.querySelector<HTMLElement>("[data-ai-composer-actions]");
const contextOverflow = hasHorizontalOverflow(contextRow) || hasOverflowingLabel(contextRow, ".ai-template-selector-label, .ai-skills-selector-label"); const contextOverflow = hasHorizontalOverflow(contextRow) || hasOverflowingLabel(contextRow, ".ai-template-selector-label, .ai-skills-selector-label");
const actionOverflow = hasHorizontalOverflow(actionRow) || hasOverflowingLabel(actionRow, ".ai-mode-action-label, .ai-model-selector-label, .ai-prompt-queue-label");
compactContextControls.value = contextOverflow; compactContextControls.value = contextOverflow;
compactActionControls.value = actionOverflow; if (actionControlsOverflow(actionRow)) {
lastResponsiveControlWidth = panelWidth; compactModelControl.value = true;
await nextTick();
if (panelResizeEpoch !== undefined && (!isPanelResizing.value || panelResizeEpoch !== responsiveControlDragEpoch)) return;
compactModeActionControl.value = actionControlsOverflow(actionRow);
}
lastResponsiveControlWidth = panelResizeEpoch === undefined ? panelWidth : (latestResponsiveControlDragWidth ?? panelWidth);
} }
function scheduleResponsiveControlMeasurement(force = false) { async function flushResponsiveControlDragMeasurements() {
if (responsiveControlDragMeasureRunning) return;
responsiveControlDragMeasureRunning = true;
const panelResizeEpoch = responsiveControlDragEpoch;
try {
while (responsiveControlDragMeasureQueued && isPanelResizing.value && panelResizeEpoch === responsiveControlDragEpoch) {
responsiveControlDragMeasureQueued = false;
const panelWidth = latestResponsiveControlDragWidth;
const panel = promptPanelRef.value;
if (panelWidth === null || !panel) continue;
if (lastResponsiveControlDragMeasureWidth !== null && Math.abs(panelWidth - lastResponsiveControlDragMeasureWidth) < AI_RESPONSIVE_DRAG_MEASURE_STEP_PX) continue;
lastResponsiveControlDragMeasureWidth = panelWidth;
await applyResponsiveControlMeasurement(panel, panelWidth, true, panelResizeEpoch);
const latestWidth = latestResponsiveControlDragWidth;
if (latestWidth !== null && Math.abs(latestWidth - panelWidth) >= AI_RESPONSIVE_DRAG_MEASURE_STEP_PX) responsiveControlDragMeasureQueued = true;
}
} finally {
responsiveControlDragMeasureRunning = false;
if (responsiveControlDragMeasureQueued && isPanelResizing.value) void flushResponsiveControlDragMeasurements();
}
}
function scheduleResponsiveControlDragMeasurement(observedPanelWidth: number) {
latestResponsiveControlDragWidth = Math.round(observedPanelWidth);
responsiveControlDragMeasureQueued = true;
void flushResponsiveControlDragMeasurements();
}
async function measureResponsiveControls(force = false, observedPanelWidth?: number) {
const panel = promptPanelRef.value;
if (!panel) return;
if (isPanelResizing.value) {
deferUntilPanelResizeEnd(resyncPromptPanelAfterPanelResize);
if (typeof observedPanelWidth === "number") scheduleResponsiveControlDragMeasurement(observedPanelWidth);
return;
}
lastResponsiveControlDragMeasureWidth = null;
const panelWidth = typeof observedPanelWidth === "number" ? Math.round(observedPanelWidth) : panel.clientWidth;
await applyResponsiveControlMeasurement(panel, panelWidth, force);
}
function scheduleResponsiveControlMeasurement(force = false, observedPanelWidth?: number) {
responsiveControlMeasureForce ||= force; responsiveControlMeasureForce ||= force;
if (typeof observedPanelWidth === "number") responsiveControlObservedWidth = observedPanelWidth;
if (responsiveControlMeasureFrame !== null) return; if (responsiveControlMeasureFrame !== null) return;
const measure = () => { const measure = () => {
responsiveControlMeasureFrame = null; responsiveControlMeasureFrame = null;
const forceMeasure = responsiveControlMeasureForce; const forceMeasure = responsiveControlMeasureForce;
const measuredPanelWidth = responsiveControlObservedWidth;
responsiveControlMeasureForce = false; responsiveControlMeasureForce = false;
void measureResponsiveControls(forceMeasure); responsiveControlObservedWidth = null;
void measureResponsiveControls(forceMeasure, measuredPanelWidth ?? undefined);
}; };
if (typeof window !== "undefined" && typeof window.requestAnimationFrame === "function") { if (typeof window !== "undefined" && typeof window.requestAnimationFrame === "function") {
responsiveControlMeasureFrame = window.requestAnimationFrame(measure); responsiveControlMeasureFrame = window.requestAnimationFrame(measure);
@@ -5296,7 +5370,7 @@ onUnmounted(() => {
// 若卸载时仍在拖拽,复位 body 样式,避免全局残留 // 若卸载时仍在拖拽,复位 body 样式,避免全局残留
document.body.style.userSelect = ""; document.body.style.userSelect = "";
document.body.style.cursor = ""; document.body.style.cursor = "";
window.removeEventListener("resize", handlePanelResize); window.removeEventListener("resize", handleWindowResize);
document.removeEventListener("dbx:tauri-file-drop", onTauriFileDrop as EventListener); document.removeEventListener("dbx:tauri-file-drop", onTauriFileDrop as EventListener);
window.removeEventListener(DBX_TABLE_REFERENCE_DROP_EVENT, onTableReferenceDropEvent); window.removeEventListener(DBX_TABLE_REFERENCE_DROP_EVENT, onTableReferenceDropEvent);
promptPanelResizeObserver?.disconnect(); promptPanelResizeObserver?.disconnect();
@@ -5305,6 +5379,11 @@ onUnmounted(() => {
responsiveControlMeasureFrame = null; responsiveControlMeasureFrame = null;
} }
responsiveControlMeasureForce = false; responsiveControlMeasureForce = false;
responsiveControlObservedWidth = null;
latestResponsiveControlDragWidth = null;
lastResponsiveControlDragMeasureWidth = null;
responsiveControlDragMeasureQueued = false;
responsiveControlDragEpoch += 1;
}); });
function triggerAction(action: AiAction, instruction?: string) { function triggerAction(action: AiAction, instruction?: string) {
@@ -6354,7 +6433,7 @@ async function openExternalUrl(url: string) {
<Clock class="h-3.5 w-3.5 shrink-0" /> <Clock class="h-3.5 w-3.5 shrink-0" />
<span>{{ t("ai.status.longRunningHint") }}</span> <span>{{ t("ai.status.longRunningHint") }}</span>
</div> </div>
<div data-ai-composer-actions :class="['ai-prompt-action-row flex min-w-0 flex-nowrap items-center gap-1.5 overflow-hidden', compactActionControls && 'ai-prompt-action-row--compact']"> <div data-ai-composer-actions :class="['ai-prompt-action-row flex min-w-0 flex-nowrap items-center gap-1.5 overflow-hidden', compactModelControl && 'ai-prompt-action-row--model-compact', compactModeActionControl && 'ai-prompt-action-row--mode-compact']">
<Tooltip> <Tooltip>
<TooltipTrigger as-child> <TooltipTrigger as-child>
<Button variant="ghost" size="icon" class="h-7 w-7 shrink-0" :disabled="isGenerating" @click="selectCsvFile"> <Button variant="ghost" size="icon" class="h-7 w-7 shrink-0" :disabled="isGenerating" @click="selectCsvFile">
@@ -6706,13 +6785,13 @@ async function openExternalUrl(url: string) {
display: none; display: none;
} }
.ai-prompt-action-row--compact { .ai-prompt-action-row--mode-compact {
gap: 0.25rem; gap: 0.25rem;
} }
.ai-prompt-action-row--compact .ai-mode-action-trigger, .ai-prompt-action-row--model-compact .ai-model-selector-trigger,
.ai-prompt-action-row--compact .ai-mode-static-trigger, .ai-prompt-action-row--mode-compact .ai-mode-action-trigger,
.ai-prompt-action-row--compact .ai-model-selector-trigger { .ai-prompt-action-row--mode-compact .ai-mode-static-trigger {
flex: 0 0 1.75rem; flex: 0 0 1.75rem;
width: 1.75rem; width: 1.75rem;
max-width: 1.75rem; max-width: 1.75rem;
@@ -6721,29 +6800,29 @@ async function openExternalUrl(url: string) {
padding: 0; padding: 0;
} }
.ai-prompt-action-row--compact .ai-mode-action-label, .ai-prompt-action-row--model-compact .ai-model-selector-label,
.ai-prompt-action-row--compact .ai-mode-action-chevron, .ai-prompt-action-row--model-compact .ai-model-selector-chevron,
.ai-prompt-action-row--compact .ai-model-selector-label, .ai-prompt-action-row--mode-compact .ai-mode-action-label,
.ai-prompt-action-row--compact .ai-model-selector-chevron { .ai-prompt-action-row--mode-compact .ai-mode-action-chevron {
display: none; display: none;
} }
.ai-prompt-action-row--compact .ai-model-selector-trigger { .ai-prompt-action-row--model-compact .ai-model-selector-trigger {
min-width: 1.75rem; min-width: 1.75rem;
} }
.ai-prompt-action-row--compact .ai-prompt-send-control { .ai-prompt-action-row--mode-compact .ai-prompt-send-control {
flex: 0 0 auto; flex: 0 0 auto;
} }
.ai-prompt-action-row--compact .ai-prompt-queue-control { .ai-prompt-action-row--mode-compact .ai-prompt-queue-control {
width: 1.75rem; width: 1.75rem;
height: 1.75rem; height: 1.75rem;
justify-content: center; justify-content: center;
padding: 0; padding: 0;
} }
.ai-prompt-action-row--compact .ai-prompt-queue-label { .ai-prompt-action-row--mode-compact .ai-prompt-queue-label {
display: none; display: none;
} }
@@ -6905,19 +6984,4 @@ html.dbx-legacy-webview.dark .ai-markdown :deep(.ai-markdown-table-wrap:hover::-
height: 9px; height: 9px;
cursor: ns-resize; cursor: ns-resize;
} }
.resize-handle::before {
content: "";
position: absolute;
top: 3px;
left: 0;
right: 0;
height: 1px;
background-color: var(--border);
transition: background-color 0.15s ease;
}
.resize-handle:hover::before {
background-color: color-mix(in srgb, var(--foreground) 20%, transparent);
}
</style> </style>
@@ -11,6 +11,7 @@ import { createPinia } from "pinia";
import i18n from "@/i18n"; import i18n from "@/i18n";
import { TooltipProvider } from "@/components/ui/tooltip"; import { TooltipProvider } from "@/components/ui/tooltip";
import AiAssistant from "@/components/editor/AiAssistant.vue"; import AiAssistant from "@/components/editor/AiAssistant.vue";
import { beginPanelResize, endPanelResize } from "@/lib/app/panelResizeState";
import { useSettingsStore } from "@/stores/settingsStore"; import { useSettingsStore } from "@/stores/settingsStore";
import { useConnectionStore } from "@/stores/connectionStore"; import { useConnectionStore } from "@/stores/connectionStore";
import type { ConnectionConfig } from "@/types/database"; import type { ConnectionConfig } from "@/types/database";
@@ -53,6 +54,8 @@ vi.mock("@/lib/backend/api", async (importOriginal) => {
const cleanups: Array<() => void> = []; const cleanups: Array<() => void> = [];
afterEach(() => { afterEach(() => {
endPanelResize();
vi.unstubAllGlobals();
aiAssistantMountApi.conversations = []; aiAssistantMountApi.conversations = [];
aiAssistantMountApi.runAgentStream = undefined; aiAssistantMountApi.runAgentStream = undefined;
while (cleanups.length) cleanups.pop()?.(); while (cleanups.length) cleanups.pop()?.();
@@ -256,6 +259,102 @@ describe("AiAssistant mount", () => {
expect(modelTrigger?.getAttribute("title")).toBe("deepseek-chat"); expect(modelTrigger?.getAttribute("title")).toBe("deepseek-chat");
}); });
it("progressively compacts and expands composer controls while the AI panel is dragged", async () => {
let resizeObserverCallback: ResizeObserverCallback | undefined;
let resizeObserver: ResizeObserver | undefined;
vi.stubGlobal(
"ResizeObserver",
class {
constructor(callback: ResizeObserverCallback) {
resizeObserverCallback = callback;
resizeObserver = this as unknown as ResizeObserver;
}
observe() {}
unobserve() {}
disconnect() {}
},
);
const { errors, container } = await mountPanel(true, undefined, (settings) => {
settings.aiConfigs = [
{
id: "deepseek-default",
name: "DeepSeek",
provider: "deepseek",
apiKey: "test-key",
authMethod: "api-key",
endpoint: "https://api.deepseek.com",
model: "deepseek-chat",
apiStyle: "completions",
isDefault: true,
},
];
settings.activeModel = { configId: "deepseek-default", modelId: "deepseek-chat" };
});
const panel = container.querySelector<HTMLElement>(".ai-prompt-context-container")!;
const contextRow = container.querySelector<HTMLElement>("[data-ai-composer-context-row]")!;
const actionRow = container.querySelector<HTMLElement>("[data-ai-composer-actions]")!;
let panelWidth = 300;
let contextClientWidth = 280;
let contextScrollWidth = 320;
let actionClientWidth = 280;
let actionFullScrollWidth = 320;
let actionModelCompactScrollWidth = 280;
Object.defineProperty(panel, "clientWidth", { configurable: true, get: () => panelWidth });
Object.defineProperty(contextRow, "clientWidth", { configurable: true, get: () => contextClientWidth });
Object.defineProperty(contextRow, "scrollWidth", { configurable: true, get: () => contextScrollWidth });
Object.defineProperty(actionRow, "clientWidth", { configurable: true, get: () => actionClientWidth });
Object.defineProperty(actionRow, "scrollWidth", {
configurable: true,
get: () => (actionRow.classList.contains("ai-prompt-action-row--model-compact") ? actionModelCompactScrollWidth : actionFullScrollWidth),
});
beginPanelResize();
resizeObserverCallback?.([{ target: panel, contentRect: { width: panelWidth } } as ResizeObserverEntry], resizeObserver!);
await new Promise((resolve) => setTimeout(resolve, 20));
expect(contextRow.classList.contains("ai-prompt-context-row--compact")).toBe(true);
expect(actionRow.classList.contains("ai-prompt-action-row--model-compact")).toBe(true);
expect(actionRow.classList.contains("ai-prompt-action-row--mode-compact")).toBe(false);
panelWidth = 240;
actionClientWidth = 220;
actionModelCompactScrollWidth = 250;
resizeObserverCallback?.([{ target: panel, contentRect: { width: panelWidth } } as ResizeObserverEntry], resizeObserver!);
await new Promise((resolve) => setTimeout(resolve, 20));
expect(actionRow.classList.contains("ai-prompt-action-row--model-compact")).toBe(true);
expect(actionRow.classList.contains("ai-prompt-action-row--mode-compact")).toBe(true);
panelWidth = 300;
actionClientWidth = 280;
actionModelCompactScrollWidth = 280;
resizeObserverCallback?.([{ target: panel, contentRect: { width: panelWidth } } as ResizeObserverEntry], resizeObserver!);
await new Promise((resolve) => setTimeout(resolve, 20));
expect(actionRow.classList.contains("ai-prompt-action-row--model-compact")).toBe(true);
expect(actionRow.classList.contains("ai-prompt-action-row--mode-compact")).toBe(false);
panelWidth = 420;
contextClientWidth = 400;
contextScrollWidth = 400;
actionClientWidth = 400;
actionFullScrollWidth = 400;
actionModelCompactScrollWidth = 400;
resizeObserverCallback?.([{ target: panel, contentRect: { width: panelWidth } } as ResizeObserverEntry], resizeObserver!);
await new Promise((resolve) => setTimeout(resolve, 20));
expect(contextRow.classList.contains("ai-prompt-context-row--compact")).toBe(false);
expect(actionRow.classList.contains("ai-prompt-action-row--model-compact")).toBe(false);
expect(actionRow.classList.contains("ai-prompt-action-row--mode-compact")).toBe(false);
endPanelResize();
await new Promise((resolve) => setTimeout(resolve, 20));
expect(contextRow.classList.contains("ai-prompt-context-row--compact")).toBe(false);
expect(actionRow.classList.contains("ai-prompt-action-row--model-compact")).toBe(false);
expect(actionRow.classList.contains("ai-prompt-action-row--mode-compact")).toBe(false);
expect(errors.map(String)).toEqual([]);
});
it.each(["plugin", "etcd"] as const)("hides database and schema selectors for %s connections", async (dbType) => { it.each(["plugin", "etcd"] as const)("hides database and schema selectors for %s connections", async (dbType) => {
const { errors, container } = await mountPanel(true, { id: "connection", name: "Connection", db_type: dbType, plugin_id: dbType === "plugin" ? "sample.plugin" : undefined, host: "localhost", port: 22, username: "", password: "" }); const { errors, container } = await mountPanel(true, { id: "connection", name: "Connection", db_type: dbType, plugin_id: dbType === "plugin" ? "sample.plugin" : undefined, host: "localhost", port: 22, username: "", password: "" });
expect(errors.map(String)).toEqual([]); expect(errors.map(String)).toEqual([]);