diff --git a/src/components/TopMenuSection.test.ts b/src/components/TopMenuSection.test.ts index 12502d7a3..b767ab7f8 100644 --- a/src/components/TopMenuSection.test.ts +++ b/src/components/TopMenuSection.test.ts @@ -156,7 +156,7 @@ describe('TopMenuSection', () => { }) it('opens the assets sidebar tab when QPO V2 is enabled', async () => { - const pinia = createTestingPinia({ createSpy: vi.fn }) + const pinia = createTestingPinia({ createSpy: vi.fn, stubActions: false }) const settingStore = useSettingStore(pinia) vi.mocked(settingStore.get).mockImplementation((key) => key === 'Comfy.Queue.QPOV2' ? true : undefined @@ -168,4 +168,21 @@ describe('TopMenuSection', () => { expect(sidebarTabStore.activeSidebarTabId).toBe('assets') }) + + it('toggles the assets sidebar tab when QPO V2 is enabled', async () => { + const pinia = createTestingPinia({ createSpy: vi.fn, stubActions: false }) + const settingStore = useSettingStore(pinia) + vi.mocked(settingStore.get).mockImplementation((key) => + key === 'Comfy.Queue.QPOV2' ? true : undefined + ) + const wrapper = createWrapper(pinia) + const sidebarTabStore = useSidebarTabStore(pinia) + const toggleButton = wrapper.find('[data-testid="queue-overlay-toggle"]') + + await toggleButton.trigger('click') + expect(sidebarTabStore.activeSidebarTabId).toBe('assets') + + await toggleButton.trigger('click') + expect(sidebarTabStore.activeSidebarTabId).toBe(null) + }) }) diff --git a/src/components/TopMenuSection.vue b/src/components/TopMenuSection.vue index 966eca29d..712846f81 100644 --- a/src/components/TopMenuSection.vue +++ b/src/components/TopMenuSection.vue @@ -183,7 +183,7 @@ onMounted(() => { const toggleQueueOverlay = () => { if (isQueuePanelV2Enabled.value) { - sidebarTabStore.activeSidebarTabId = 'assets' + sidebarTabStore.toggleSidebarTab('assets') return } commandStore.execute('Comfy.Queue.ToggleOverlay')