feat(file-browser): add context-aware copy submenu (#517)

* feat(file-browser): add context-aware copy submenu

* refactor(file-browser): address code review feedback for copy submenu

* fix(webui): align submenu trigger text and widen file context menu

* test(e2e): guard clipboard permissions in copy-menu spec for cross-browser support
This commit is contained in:
Yiling-J
2026-11-05 09:57:34 +08:00
committed by GitHub
parent 2ecbd49d18
commit 0dc0bbeb03
30 changed files with 2285 additions and 106 deletions
@@ -80,4 +80,19 @@ describe('FileBrowserContextMenu', () => {
expect(screen.queryByText(/Manage versions|管理版本/i)).toBeNull()
})
it('renders Copy submenu trigger for regular file item with aligned gap-2 and w-52 menu width', () => {
renderWithMenu(fileItem)
fireEvent.contextMenu(screen.getByTestId('context-trigger'))
const copyOption = screen.getByText(/^Copy$|^复制$/i)
expect(copyOption).toBeTruthy()
const trigger = copyOption.closest('[data-slot="context-menu-sub-trigger"]')
expect(trigger?.className).toContain('gap-2')
const menuContent = copyOption.closest('[data-slot="context-menu-content"]')
expect(menuContent?.className).toContain('w-52')
})
})