fix(connection): keep forms scrollable in short dialogs

This commit is contained in:
zipg authored and GitHub committed 2026-07-30 14:30:30 +08:00
1 parent 01f5da1c4e
commit e9ea840e1b
2 files changed
+14 -12

No files matched your search

@@ -4,14 +4,16 @@ import { describe, expect, it } from "vitest";
const dialogSource = readFileSync(new URL("../../../components/connection/ConnectionDialog.vue", import.meta.url), "utf8");
describe("connection dialog scrolling", () => {
it("gives the configuration step a definite viewport-constrained height", () => {
it("keeps every configuration tab inside a shrinkable form viewport", () => {
expect(dialogSource).toContain("return `${widthClass} connection-dialog-content--config`;");
expect(dialogSource).toMatch(/\.connection-dialog-content--config\s*\{[\s\S]*?min-height:\s*0;[\s\S]*?@media \(max-height: 720px\)[\s\S]*?height:\s*calc\(var\(--dbx-viewport-height\) - 2rem\);/);
expect(dialogSource.match(/<TabsContent[^>]*class="m-0 flex min-h-0 flex-1 flex-col overflow-hidden">/g)).toHaveLength(4);
expect(dialogSource.match(/class="connection-form-body grid min-h-0 flex-1 gap-4 overflow-y-auto/g)).toHaveLength(4);
expect(dialogSource).toMatch(/@media \(max-height: 720px\)[\s\S]*?height:\s*calc\(var\(--dbx-viewport-height\) - 2rem\);/);
expect(dialogSource).toMatch(/\.connection-dialog-content--config \.connection-form-body\s*\{[\s\S]*?align-content:\s*start;/);
});
it("keeps the transport form inside a shrinkable scroll viewport", () => {
expect(dialogSource).toContain('<TabsContent v-if="canUseTransportLayers" value="transport" class="m-0 min-h-0 flex-1 overflow-hidden">');
expect(dialogSource).toContain('class="connection-form-body grid h-full min-h-0 gap-4 overflow-y-auto overflow-x-hidden pt-4 pr-2"');
expect(dialogSource).toContain('<TabsContent v-if="canUseTransportLayers" value="transport" class="m-0 flex min-h-0 flex-1 flex-col overflow-hidden">');
expect(dialogSource).toContain('class="connection-form-body grid min-h-0 flex-1 gap-4 overflow-y-auto overflow-x-hidden pt-4 pr-2"');
});
});