Comfy-Org / Comfy-Org/ComfyUI_frontend
test: add dedicated component test for SlotContextMenu.vue (positioning, show/hide lifecycle, dialog integration)
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 699
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 490
Description
## Summary
Add a dedicated component test for `SlotContextMenu.vue` to cover the complexity that lives in the component itself, beyond what the pure-function unit tests (`canRenameSlot`, `renameSlot`) and e2e tests already cover.
## Motivation
Currently, unit tests cover the pure service functions in `slotMenuService.ts` and e2e tests cover the full rename/disconnect/remove flow. However, there is no component-level test for `SlotContextMenu.vue` itself, where most of the complexity lives.
## Scope
A component test (e.g., `SlotContextMenu.test.ts`) should cover at minimum:
- **Positioning logic**: world-to-screen coordinate translation accounting for canvas scale and offset; `updateMenuPosition()` repositions correctly when canvas transform changes.
- **Show/hide lifecycle**: `show(event, context)` opens the menu and starts the RAF sync loop; `hide()` closes it and stops the loop; `isOpen` reactive state is consistent.
- **Menu item construction**: items reflect `canRenameSlot(ctx)` result (Rename item present/absent based on slot state).
- **Dialog integration**: `handleRename(ctx)` calls `dialogService.prompt()` and delegates to `renameSlot` on confirmation; no-ops on cancel.
## Related
- PR: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9045
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/9045#discussion_r2925519412
/cc @christian-byrne
┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11893-test-add-dedicated-component-test-for-SlotContextMenu-vue-positioning-show-hide-li-3566d73d365081c6b3c7e4c6623f09a8) by [Unito](https://www.unito.io)
Contributor guide
Assessment
This issue has not been assessed yet.