1 parent
efba56c8c0
commit
a6edbd7fcb
3 files changed
+35
-6
No files matched your search
@@ -4,6 +4,25 @@ import { describe, expect, it } from "vitest";
|
||||
const dialogSource = readFileSync(new URL("../DataTransferDialog.vue", import.meta.url), "utf8");
|
||||
|
||||
describe("DataTransferDialog layout", () => {
|
||||
it("keeps only the main dialog resizable within safe viewport bounds", () => {
|
||||
const dialogContentTags = dialogSource.match(/<DialogContent\b[^>]*>/g) ?? [];
|
||||
const resizableDialogs = dialogContentTags.filter((tag) => tag.includes(" resize"));
|
||||
|
||||
expect(resizableDialogs).toHaveLength(1);
|
||||
expect(resizableDialogs[0]).toContain('class="dbx-transfer-dialog sm:max-w-[1120px] max-h-[80vh] flex flex-col overflow-hidden resize"');
|
||||
expect(resizableDialogs[0]).toContain(':style="transferDialogStyle"');
|
||||
expect(dialogSource).toContain('width: "min(1120px, calc(100vw - 2rem))"');
|
||||
expect(dialogSource).toContain('height: "min(80vh, calc(var(--dbx-viewport-height) - 2rem))"');
|
||||
expect(dialogSource).toContain('minWidth: "min(780px, calc(100vw - 2rem))"');
|
||||
expect(dialogSource).toContain('minHeight: "min(480px, calc(var(--dbx-viewport-height) - 2rem))"');
|
||||
expect(dialogSource).toContain('maxWidth: "calc(100vw - 2rem)"');
|
||||
expect(dialogSource).toContain('maxHeight: "calc(var(--dbx-viewport-height) - 2rem)"');
|
||||
});
|
||||
|
||||
it("keeps source and target side by side while the dialog changes size", () => {
|
||||
expect(dialogSource).toContain('class="grid grid-cols-[1fr_auto_1fr] gap-4 items-start"');
|
||||
});
|
||||
|
||||
it("keeps the header and footer outside the shrinking content region", () => {
|
||||
expect(dialogSource).toContain('<DialogHeader class="shrink-0">');
|
||||
expect(dialogSource).toContain('<DialogFooter class="shrink-0">');
|
||||
|
||||
Reference in new issue
Block a user