From ad55722662741792634bd27558fe1a04148cd9b5 Mon Sep 17 00:00:00 2001 From: Chenlei Hu Date: Sat, 5 Oct 2024 14:06:29 -0400 Subject: [PATCH] Docking action bar on top menu bar (#1119) * Teleport when docked * Docking logic * Remove unnecessary v-show * Docked panel style * Drop zone highlight * Rename test * Add playwright test --- .../{appMenu.spec.ts => actionbar.spec.ts} | 11 +++ browser_tests/helpers/actionbar.ts | 5 ++ src/components/actionbar/ComfyActionbar.vue | 73 ++++++++++++++++--- src/components/topbar/TopMenubar.vue | 39 ++++++++-- src/views/GraphView.vue | 2 - 5 files changed, 112 insertions(+), 18 deletions(-) rename browser_tests/{appMenu.spec.ts => actionbar.spec.ts} (92%) diff --git a/browser_tests/appMenu.spec.ts b/browser_tests/actionbar.spec.ts similarity index 92% rename from browser_tests/appMenu.spec.ts rename to browser_tests/actionbar.spec.ts index 97e892b3e0..ae0c257cff 100644 --- a/browser_tests/appMenu.spec.ts +++ b/browser_tests/actionbar.spec.ts @@ -113,4 +113,15 @@ test.describe('Actionbar', () => { ).toBe(END) expect(promptNumber, 'queued prompt count should be 2').toBe(2) }) + + test('Can dock actionbar into top menu', async ({ comfyPage }) => { + await comfyPage.page.dragAndDrop( + '.actionbar .drag-handle', + '.comfyui-menu', + { + targetPosition: { x: 0, y: 0 } + } + ) + expect(await comfyPage.actionbar.isDocked()).toBe(true) + }) }) diff --git a/browser_tests/helpers/actionbar.ts b/browser_tests/helpers/actionbar.ts index e5980d0abe..674979e59e 100644 --- a/browser_tests/helpers/actionbar.ts +++ b/browser_tests/helpers/actionbar.ts @@ -9,6 +9,11 @@ export class ComfyActionbar { this.root = page.locator('.actionbar') this.queueButton = new ComfyQueueButton(this) } + + async isDocked() { + const className = await this.root.getAttribute('class') + return className?.includes('is-docked') ?? false + } } class ComfyQueueButton { diff --git a/src/components/actionbar/ComfyActionbar.vue b/src/components/actionbar/ComfyActionbar.vue index ac9557c6fd..c7007d2e23 100644 --- a/src/components/actionbar/ComfyActionbar.vue +++ b/src/components/actionbar/ComfyActionbar.vue @@ -1,9 +1,8 @@