Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(web): name the snippet info menu trigger (#40251)

yyh06e757a9e948
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 0dddfd30adb..801d831b6ec 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(<SnippetInfoDropdown snippet={mockSnippet} />)
- 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(<SnippetInfoDropdown snippet={mockSnippet} />)
- 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(<SnippetInfoDropdown snippet={mockSnippet} />)
- 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(<SnippetInfoDropdown snippet={mockSnippet} />)
- 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(<SnippetInfoDropdown snippet={mockSnippet} />)
- 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(<SnippetInfoDropdown snippet={mockSnippet} />)
- 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(<SnippetInfoDropdown snippet={mockSnippet} />)
- 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 c5c0a1a0782..1dfee4a5bf8 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 (
<>
<DropdownMenu open={open} onOpenChange={setOpen}>
- <DropdownMenuTrigger 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">
+ <DropdownMenuTrigger
+ aria-label={t(($) => $['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"
+ >
<span aria-hidden className="i-ri-more-fill size-4" />
</DropdownMenuTrigger>
<DropdownMenuContent placement="bottom-end" sideOffset={4} popupClassName="w-[180px] p-1">