mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 14:54:37 +00:00
## Summary Closes the zoom menu popup when clicking show/hide minimap to prevent the menu from remaining open after toggling. ## Changes - **What**: Adds `close` event emission from `ZoomControlsModal` when minimap toggle is clicked, wired to `hideModal` in parent `GraphCanvasMenu` - **Tests**: Adds unit tests verifying close behavior for minimap toggle vs other commands ## Review Focus This fixes the immediate UX issue where the zoom popup remained open after toggling minimap visibility. However, the minimap toggle's placement within the zoom menu is **not** ideal—it's not intuitive to look for minimap controls within zoom controls. This PR addresses the current UX friction without tackling the broader discoverability issue. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5974-Close-zoom-menu-when-toggling-minimap-visibility-2866d73d365081bdbb0bfeb0da4b8c2b) by [Unito](https://www.unito.io) --------- Co-authored-by: DrJKL <DrJKL0424@gmail.com>
104 lines
3.3 KiB
TypeScript
104 lines
3.3 KiB
TypeScript
import { expect } from '@playwright/test'
|
|
|
|
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
|
|
|
test.describe('Minimap', () => {
|
|
test.beforeEach(async ({ comfyPage }) => {
|
|
await comfyPage.setSetting('Comfy.UseNewMenu', 'Top')
|
|
await comfyPage.setSetting('Comfy.Minimap.Visible', true)
|
|
await comfyPage.setSetting('Comfy.Graph.CanvasMenu', true)
|
|
await comfyPage.loadWorkflow('default')
|
|
await comfyPage.page.waitForFunction(
|
|
() => window['app'] && window['app'].canvas
|
|
)
|
|
})
|
|
|
|
test('Validate minimap is visible by default', async ({ comfyPage }) => {
|
|
const minimapContainer = comfyPage.page.locator('.litegraph-minimap')
|
|
|
|
await expect(minimapContainer).toBeVisible()
|
|
|
|
const minimapCanvas = minimapContainer.locator('.minimap-canvas')
|
|
await expect(minimapCanvas).toBeVisible()
|
|
|
|
const minimapViewport = minimapContainer.locator('.minimap-viewport')
|
|
await expect(minimapViewport).toBeVisible()
|
|
|
|
await expect(minimapContainer).toHaveCSS('position', 'relative')
|
|
|
|
// position and z-index validation moved to the parent container of the minimap
|
|
const minimapMainContainer = comfyPage.page.locator(
|
|
'.minimap-main-container'
|
|
)
|
|
await expect(minimapMainContainer).toHaveCSS('position', 'absolute')
|
|
await expect(minimapMainContainer).toHaveCSS('z-index', '1000')
|
|
})
|
|
|
|
test('Validate minimap toggle button state', async ({ comfyPage }) => {
|
|
// Open zoom controls dropdown first
|
|
const zoomControlsButton = comfyPage.page.getByTestId(
|
|
'zoom-controls-button'
|
|
)
|
|
await zoomControlsButton.click()
|
|
|
|
const toggleButton = comfyPage.page.getByTestId('toggle-minimap-button')
|
|
|
|
await expect(toggleButton).toBeVisible()
|
|
|
|
const minimapContainer = comfyPage.page.locator('.litegraph-minimap')
|
|
await expect(minimapContainer).toBeVisible()
|
|
})
|
|
|
|
test('Validate minimap can be toggled off and on', async ({ comfyPage }) => {
|
|
const minimapContainer = comfyPage.page.locator('.litegraph-minimap')
|
|
|
|
// Open zoom controls dropdown first
|
|
const zoomControlsButton = comfyPage.page.getByTestId(
|
|
'zoom-controls-button'
|
|
)
|
|
await zoomControlsButton.click()
|
|
|
|
const toggleButton = comfyPage.page.getByTestId('toggle-minimap-button')
|
|
|
|
await expect(minimapContainer).toBeVisible()
|
|
|
|
await toggleButton.click()
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect(minimapContainer).not.toBeVisible()
|
|
|
|
// Open zoom controls dropdown again
|
|
await zoomControlsButton.click()
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect(toggleButton).toContainText('Show Minimap')
|
|
|
|
await toggleButton.click()
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect(minimapContainer).toBeVisible()
|
|
|
|
// Open zoom controls dropdown again to verify button text
|
|
await zoomControlsButton.click()
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect(toggleButton).toContainText('Hide Minimap')
|
|
})
|
|
|
|
test('Validate minimap keyboard shortcut Alt+M', async ({ comfyPage }) => {
|
|
const minimapContainer = comfyPage.page.locator('.litegraph-minimap')
|
|
|
|
await expect(minimapContainer).toBeVisible()
|
|
|
|
await comfyPage.page.keyboard.press('Alt+KeyM')
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect(minimapContainer).not.toBeVisible()
|
|
|
|
await comfyPage.page.keyboard.press('Alt+KeyM')
|
|
await comfyPage.nextFrame()
|
|
|
|
await expect(minimapContainer).toBeVisible()
|
|
})
|
|
})
|