Skip to content
Draft
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 @@ -45,10 +45,8 @@ vi.mock('@/utils/var', () => ({
}))

vi.mock('@/app/components/base/action-button', () => ({
default: ({ onClick, children }: { onClick?: () => void; children: React.ReactNode }) => (
<button data-testid="close-button" onClick={onClick}>
{children}
</button>
default: ({ children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>) => (
<button {...props}>{children}</button>
),
}))

Expand Down Expand Up @@ -219,7 +217,7 @@ describe('DetailHeader', () => {
render(<DetailHeader detail={createDetail()} onHide={onHide} onUpdate={vi.fn()} />)

fireEvent.click(screen.getByText('plugin.detailPanel.operation.update'))
fireEvent.click(screen.getByTestId('close-button'))
fireEvent.click(screen.getByRole('button', { name: 'common.operation.close' }))

expect(mockHandleUpdate).toHaveBeenCalledTimes(1)
expect(onHide).toHaveBeenCalled()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ const DetailHeader = ({
showCheckVersion={canUpdatePlugin}
showRemove={canDeletePlugin}
/>
<ActionButton onClick={onHide}>
<ActionButton
aria-label={t(($) => $['operation.close'], { ns: 'common' })}
onClick={onHide}
>
<span aria-hidden className="i-ri-close-line size-4" />
</ActionButton>
</div>
Expand Down