Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,12 @@ vi.mock('@/app/components/app/text-generate/item', () => ({
vi.mock('@/app/components/base/action-button', () => ({
default: ({
children,
onClick,
state,
}: {
children: React.ReactNode
onClick?: () => void
...props
}: React.ButtonHTMLAttributes<HTMLButtonElement> & {
state?: string
}) => (
<button type="button" data-testid="action-button" data-state={state} onClick={onClick}>
<button type="button" data-testid="action-button" data-state={state} {...props}>
{children}
</button>
),
Expand Down Expand Up @@ -581,7 +579,7 @@ describe('Debug', () => {

expect(screen.getByTestId('debug-with-single-model'))!.toBeInTheDocument()

fireEvent.click(screen.getAllByTestId('action-button')[0]!)
fireEvent.click(screen.getByRole('button', { name: 'common.operation.refresh' }))
expect(mockState.mockHandleRestart).toHaveBeenCalledTimes(1)
})

Expand All @@ -607,7 +605,14 @@ describe('Debug', () => {
})

expect(screen.getByTestId('chat-user-input'))!.toBeInTheDocument()
fireEvent.click(screen.getAllByTestId('action-button')[1]!)
const inputPanelButton = screen.getByRole('button', {
name: 'workflow.panel.userInputField',
})
expect(inputPanelButton).toHaveAttribute('aria-expanded', 'true')

fireEvent.click(inputPanelButton)

expect(inputPanelButton).toHaveAttribute('aria-expanded', 'false')
expect(screen.queryByTestId('chat-user-input')).not.toBeInTheDocument()
})

Expand All @@ -619,7 +624,7 @@ describe('Debug', () => {
},
})

fireEvent.click(screen.getAllByTestId('action-button')[0]!)
fireEvent.click(screen.getByRole('button', { name: 'common.operation.refresh' }))
expect(mockState.mockHandleRestart).toHaveBeenCalledTimes(1)
})

Expand All @@ -631,7 +636,9 @@ describe('Debug', () => {
},
})

expect(screen.queryByTestId('action-button')).not.toBeInTheDocument()
expect(
screen.queryByRole('button', { name: 'common.operation.refresh' }),
).not.toBeInTheDocument()
})

it('should show formatting confirmation and handle cancel', () => {
Expand Down
11 changes: 8 additions & 3 deletions web/app/components/app/configuration/debug/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,11 @@ const Debug: FC<IDebug> = ({
<Tooltip>
<TooltipTrigger
render={
<ActionButton onClick={clearConversation}>
<RefreshCcw01 className="size-4" />
<ActionButton
aria-label={t(($) => $['operation.refresh'], { ns: 'common' })}
onClick={clearConversation}
>
<RefreshCcw01 aria-hidden="true" className="size-4" />
</ActionButton>
}
/>
Expand All @@ -459,11 +462,13 @@ const Debug: FC<IDebug> = ({
<TooltipTrigger
render={
<ActionButton
aria-expanded={expanded}
aria-label={t(($) => $['panel.userInputField'], { ns: 'workflow' })}
state={expanded ? ActionButtonState.Active : undefined}
disabled={!canTestAndRun}
onClick={() => setExpanded(!expanded)}
>
<RiEqualizer2Line className="size-4" />
<RiEqualizer2Line aria-hidden="true" className="size-4" />
</ActionButton>
}
/>
Expand Down