From c5d8a9d9daa1c846fa9de89c5756d286590e5036 Mon Sep 17 00:00:00 2001 From: yyh Date: Sun, 9 Aug 2026 14:17:35 +0800 Subject: [PATCH] fix(web): name the snippet info menu trigger --- .../snippet-info/__tests__/dropdown.spec.tsx | 14 +++++++------- .../app-sidebar/snippet-info/dropdown.tsx | 5 ++++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/web/app/components/app-sidebar/snippet-info/__tests__/dropdown.spec.tsx b/web/app/components/app-sidebar/snippet-info/__tests__/dropdown.spec.tsx index 0dddfd30adb3a2..801d831b6ec45d 100644 --- a/web/app/components/app-sidebar/snippet-info/__tests__/dropdown.spec.tsx +++ b/web/app/components/app-sidebar/snippet-info/__tests__/dropdown.spec.tsx @@ -133,7 +133,7 @@ describe('SnippetInfoDropdown', () => { it('should render the dropdown trigger button', () => { render() - expect(screen.getByRole('button')).toBeInTheDocument() + expect(screen.getByRole('button', { name: 'common.operation.more' })).toBeInTheDocument() }) it('should render nothing without snippet create or management permission', () => { @@ -149,7 +149,7 @@ describe('SnippetInfoDropdown', () => { mockWorkspacePermissionKeys = ['snippets.create_and_modify'] const { unmount } = render() - await user.click(screen.getByRole('button')) + await user.click(screen.getByRole('button', { name: 'common.operation.more' })) expect(screen.getByText('snippet.menu.editInfo')).toBeInTheDocument() expect(screen.getByText('snippet.menu.exportSnippet')).toBeInTheDocument() @@ -158,7 +158,7 @@ describe('SnippetInfoDropdown', () => { unmount() mockWorkspacePermissionKeys = ['snippets.management'] render() - await user.click(screen.getByRole('button')) + await user.click(screen.getByRole('button', { name: 'common.operation.more' })) expect(screen.queryByText('snippet.menu.editInfo')).not.toBeInTheDocument() expect(screen.queryByText('snippet.menu.exportSnippet')).not.toBeInTheDocument() @@ -177,7 +177,7 @@ describe('SnippetInfoDropdown', () => { ) render() - await user.click(screen.getByRole('button')) + await user.click(screen.getByRole('button', { name: 'common.operation.more' })) await user.click(screen.getByText('snippet.menu.editInfo')) expect(screen.getByTestId('create-snippet-dialog')).toBeInTheDocument() @@ -216,7 +216,7 @@ describe('SnippetInfoDropdown', () => { render() - await user.click(screen.getByRole('button')) + await user.click(screen.getByRole('button', { name: 'common.operation.more' })) await user.click(screen.getByText('snippet.menu.exportSnippet')) await waitFor(() => { @@ -236,7 +236,7 @@ describe('SnippetInfoDropdown', () => { render() - await user.click(screen.getByRole('button')) + await user.click(screen.getByRole('button', { name: 'common.operation.more' })) await user.click(screen.getByText('snippet.menu.exportSnippet')) await waitFor(() => { @@ -257,7 +257,7 @@ describe('SnippetInfoDropdown', () => { render() - await user.click(screen.getByRole('button')) + await user.click(screen.getByRole('button', { name: 'common.operation.more' })) await user.click(screen.getByText('snippet.menu.deleteSnippet')) expect(screen.getByText('snippet.deleteConfirmTitle')).toBeInTheDocument() diff --git a/web/app/components/app-sidebar/snippet-info/dropdown.tsx b/web/app/components/app-sidebar/snippet-info/dropdown.tsx index c5c0a1a0782365..1dfee4a5bf81eb 100644 --- a/web/app/components/app-sidebar/snippet-info/dropdown.tsx +++ b/web/app/components/app-sidebar/snippet-info/dropdown.tsx @@ -126,7 +126,10 @@ const SnippetInfoDropdown = ({ snippet }: SnippetInfoDropdownProps) => { return ( <> - + $['operation.more'], { ns: 'common' })} + className="action-btn action-btn-m size-6 rounded-md text-text-tertiary data-popup-open:bg-state-base-hover data-popup-open:text-text-secondary" + >