fix(web): name human input delete action (#40293)

This commit is contained in:
yyh
2026-08-10 02:56:14 +00:00
committed by GitHub
parent c944a25585
commit 2a66b49bc7
2 changed files with 8 additions and 3 deletions
@@ -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()
})
})
@@ -101,7 +101,12 @@ const UserActionItem: FC<UserActionItemProps> = ({ data, onChange, onDelete, rea
readonly={readonly}
/>
{!readonly && (
<Button className="px-2" variant="tertiary" onClick={() => onDelete(data.id)}>
<Button
aria-label={t(($) => $['operation.delete'], { ns: 'common' })}
className="px-2"
variant="tertiary"
onClick={() => onDelete(data.id)}
>
<RiDeleteBinLine className="size-4" />
</Button>
)}