mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
refactor(files): share markdown link handling across renderers
This commit is contained in:
1 parent
fd1e8d16ca
commit
3451a0e24d
9 files changed
+172
-112
No files matched your search
@@ -91,6 +91,23 @@ describe('MessagePart', () => {
|
||||
expect(screen.getByText('Hello, this is a text message')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
it('opens local markdown links in a text part through onFileClick and external links in a new tab', () => {
|
||||
const onFileClick = vi.fn()
|
||||
renderWithProviders(
|
||||
<MessagePart
|
||||
part={textPart('[recap](recaps/daily-overview.html)\n\n[site](https://example.com)')}
|
||||
onFileClick={onFileClick}
|
||||
/>,
|
||||
)
|
||||
|
||||
fireEvent.click(screen.getByRole('link', { name: 'recap' }))
|
||||
expect(onFileClick).toHaveBeenCalledWith('recaps/daily-overview.html')
|
||||
|
||||
const external = screen.getByRole('link', { name: 'site' })
|
||||
expect(external).toHaveAttribute('target', '_blank')
|
||||
expect(external).toHaveAttribute('rel', 'noopener noreferrer')
|
||||
})
|
||||
|
||||
it('renders null for an empty text part', () => {
|
||||
const { container } = renderWithProviders(<MessagePart part={textPart(' ')} />)
|
||||
|
||||
|
||||
Reference in new issue
Block a user