mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 00:02:31 +00:00
fix(renderer): remove duplicate git history tooltips (#14453)
* fix(renderer): remove duplicate git history tooltips * test(renderer): harden tooltip regression coverage
This commit is contained in:
@@ -76,4 +76,29 @@ describe('GitHistoryPanel', () => {
|
||||
expect(markup).toContain('Fix tab overflow')
|
||||
expect(markup).toContain('52ad492')
|
||||
})
|
||||
|
||||
it('does not add native title tooltips alongside managed history tooltips', () => {
|
||||
const result = makeHistoryResult()
|
||||
result.items[0].references = [
|
||||
{ id: 'refs/heads/main', name: 'main', category: 'branches' },
|
||||
{ id: 'refs/heads/feature', name: 'feature', category: 'branches' },
|
||||
{ id: 'refs/tags/v1.0.0', name: 'v1.0.0', category: 'tags' }
|
||||
]
|
||||
|
||||
const markup = renderToStaticMarkup(
|
||||
<GitHistoryPanel
|
||||
state={{ status: 'ready', result }}
|
||||
collapsed={false}
|
||||
onToggle={vi.fn()}
|
||||
onRefresh={vi.fn()}
|
||||
onOpenCommit={vi.fn()}
|
||||
/>
|
||||
)
|
||||
|
||||
expect(markup).not.toContain('title="Fix tab overflow"')
|
||||
expect(markup).not.toContain('title="main"')
|
||||
expect(markup).not.toContain('title="feature"')
|
||||
expect(markup).not.toContain('title="v1.0.0"')
|
||||
expect(markup).not.toMatch(/\stitle=/)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -20,7 +20,6 @@ function GitHistoryRefBadge({ itemRef }: { itemRef: GitHistoryItemRef }): React.
|
||||
borderColor: itemRef.color ? graphColor(itemRef.color) : 'var(--border)',
|
||||
color: itemRef.color ? graphColor(itemRef.color) : 'var(--muted-foreground)'
|
||||
}}
|
||||
title={itemRef.name}
|
||||
>
|
||||
{itemRef.name}
|
||||
</span>
|
||||
@@ -90,9 +89,7 @@ export const GitHistoryRow = React.forwardRef<HTMLElement, GitHistoryRowProps>(
|
||||
)}
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span className="block min-w-0 flex-1 truncate text-foreground" title={rowTooltip}>
|
||||
{item.subject}
|
||||
</span>
|
||||
<span className="block min-w-0 flex-1 truncate text-foreground">{item.subject}</span>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent
|
||||
side="bottom"
|
||||
@@ -112,10 +109,7 @@ export const GitHistoryRow = React.forwardRef<HTMLElement, GitHistoryRowProps>(
|
||||
{hiddenRefs.length > 0 && (
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<span
|
||||
className="shrink-0 text-[10px] leading-none text-muted-foreground"
|
||||
title={hiddenRefs.map((ref) => ref.name).join(', ')}
|
||||
>
|
||||
<span className="shrink-0 text-[10px] leading-none text-muted-foreground">
|
||||
+{hiddenRefs.length}
|
||||
</span>
|
||||
</TooltipTrigger>
|
||||
@@ -135,7 +129,6 @@ export const GitHistoryRow = React.forwardRef<HTMLElement, GitHistoryRowProps>(
|
||||
{...rootProps}
|
||||
ref={ref as React.Ref<HTMLDivElement>}
|
||||
className={rowClassName}
|
||||
title={rowTooltip}
|
||||
data-testid="git-history-row"
|
||||
>
|
||||
{rowContent}
|
||||
@@ -157,7 +150,6 @@ export const GitHistoryRow = React.forwardRef<HTMLElement, GitHistoryRowProps>(
|
||||
ref={ref as React.Ref<HTMLButtonElement>}
|
||||
type="button"
|
||||
className={rowClassName}
|
||||
title={rowTooltip}
|
||||
aria-expanded={canExpand ? expanded : undefined}
|
||||
aria-label={
|
||||
canExpand
|
||||
|
||||
@@ -73,7 +73,9 @@ test('keeps conventional commit-message lines intact in the history tooltip', as
|
||||
|
||||
const row = orcaPage.getByTestId('git-history-row').filter({ hasText: subject })
|
||||
await expect(row).toBeVisible({ timeout: 10_000 })
|
||||
await expect(row).not.toHaveAttribute('title')
|
||||
const trigger = row.locator('[data-slot="tooltip-trigger"]').filter({ hasText: subject })
|
||||
await expect(trigger).not.toHaveAttribute('title')
|
||||
await trigger.hover({ position: { x: 20, y: 10 } })
|
||||
await trigger.hover({ position: { x: 40, y: 10 } })
|
||||
|
||||
|
||||
Reference in New Issue
Block a user