mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix(markdown): address inline image review feedback
Keep the leading slash when resolving relative paths against an absolute markdown file, retry an inline image when its source changes after a load failure, and render linked markdown images without a nested expand button.
This commit is contained in:
1 parent
458f26134b
commit
f488b8762d
7 files changed
+118
-22
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { render, screen, fireEvent } from '@testing-library/react'
|
||||
import { render, screen, fireEvent, within } from '@testing-library/react'
|
||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||
import { MemoryRouter } from 'react-router-dom'
|
||||
import { MessagePart } from './MessagePart'
|
||||
@@ -175,6 +175,22 @@ describe('MessagePart', () => {
|
||||
|
||||
expect(container.querySelector('img')).toBeNull()
|
||||
})
|
||||
|
||||
it('renders a linked image without a nested expand button', () => {
|
||||
renderWithProviders(
|
||||
<MessagePart part={textPart('[](https://example.com)')} />,
|
||||
)
|
||||
|
||||
const link = screen.getByRole('link')
|
||||
expect(within(link).getByAltText('logo')).toHaveAttribute('src', 'https://example.com/a.png')
|
||||
expect(within(link).queryByRole('button')).toBeNull()
|
||||
})
|
||||
|
||||
it('renders an expand button for an unlinked image', () => {
|
||||
renderWithProviders(<MessagePart part={textPart('')} />)
|
||||
|
||||
expect(screen.getByRole('button', { name: 'Expand image: logo' })).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
describe('reasoning', () => {
|
||||
|
||||
Reference in new issue
Block a user