Compare commits

...

2 Commits

Author SHA1 Message Date
yyh
467cb203df refactor(web): use css icon for human input delete 2026-08-09 16:28:10 +08:00
yyh
f3d2c6bdf2 fix(web): name human input delete action 2026-08-09 16:25:12 +08:00
2 changed files with 9 additions and 5 deletions

View File

@@ -122,7 +122,7 @@ describe('UserActionItem', () => {
target: { value: ' ' },
})
fireEvent.click(screen.getByText('change-style'))
fireEvent.click(screen.getAllByRole('button')[1]!)
fireEvent.click(screen.getByRole('button', { name: 'operation.delete' }))
expect(onChange).toHaveBeenNthCalledWith(1, expect.objectContaining({ id: '' }))
expect(onChange).toHaveBeenNthCalledWith(
@@ -135,6 +135,6 @@ describe('UserActionItem', () => {
expect(screen.getByTestId('nodes.humanInput.userActions.actionNamePlaceholder'))!.toBeDisabled()
expect(screen.getByTestId('nodes.humanInput.userActions.buttonTextPlaceholder'))!.toBeDisabled()
expect(screen.getAllByRole('button')).toHaveLength(1)
expect(screen.queryByRole('button', { name: 'operation.delete' })).not.toBeInTheDocument()
})
})

View File

@@ -2,7 +2,6 @@ import type { FC } from 'react'
import type { UserAction } from '../types'
import { Button } from '@langgenius/dify-ui/button'
import { toast } from '@langgenius/dify-ui/toast'
import { RiDeleteBinLine } from '@remixicon/react'
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import Input from '@/app/components/base/input'
@@ -101,8 +100,13 @@ const UserActionItem: FC<UserActionItemProps> = ({ data, onChange, onDelete, rea
readonly={readonly}
/>
{!readonly && (
<Button className="px-2" variant="tertiary" onClick={() => onDelete(data.id)}>
<RiDeleteBinLine className="size-4" />
<Button
aria-label={t(($) => $['operation.delete'], { ns: 'common' })}
className="px-2"
variant="tertiary"
onClick={() => onDelete(data.id)}
>
<span aria-hidden className="i-ri-delete-bin-line size-4" />
</Button>
)}
</div>