From 20a39999684d453b9cecacd73e22eacf4f4ced66 Mon Sep 17 00:00:00 2001 From: Jinwoo Hong <73622457+Jinwoo-H@users.noreply.github.com> Date: Tue, 23 Jun 2026 00:10:55 -0700 Subject: [PATCH] Fix source control base branch truncation (#6146) Co-authored-by: Orca --- ...source-control-branch-context-row.test.tsx | 40 +++++++++++++++++++ .../source-control-branch-context-row.tsx | 40 +++++++++++-------- 2 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 src/renderer/src/components/right-sidebar/source-control-branch-context-row.test.tsx diff --git a/src/renderer/src/components/right-sidebar/source-control-branch-context-row.test.tsx b/src/renderer/src/components/right-sidebar/source-control-branch-context-row.test.tsx new file mode 100644 index 000000000..c9eb2fad9 --- /dev/null +++ b/src/renderer/src/components/right-sidebar/source-control-branch-context-row.test.tsx @@ -0,0 +1,40 @@ +import { renderToStaticMarkup } from 'react-dom/server' +import type { ReactNode } from 'react' +import { describe, expect, it, vi } from 'vitest' +import { SourceControlBranchContextRow } from './source-control-branch-context-row' +import type { GitBranchCompareSummary } from '../../../../shared/types' + +vi.mock('@/components/ui/tooltip', () => ({ + Tooltip: ({ children }: { children: ReactNode }) => <>{children}, + TooltipContent: ({ children }: { children: ReactNode }) => <>{children}, + TooltipTrigger: ({ children }: { children: ReactNode }) => <>{children} +})) + +const readySummary: GitBranchCompareSummary = { + baseRef: 'refs/remotes/origin/FRONT-192-ZisVoucherStrip', + baseOid: 'base', + compareRef: 'feature', + headOid: 'head', + mergeBase: 'base', + changedFiles: 0, + commitsAhead: 0, + status: 'ready' +} + +describe('SourceControlBranchContextRow', () => { + it('lets the base ref use the full available header width', () => { + const markup = renderToStaticMarkup( + + ) + + expect(markup).toContain('refs/remotes/origin/FRONT-192-ZisVoucherStrip') + expect(markup).toContain('max-w-full') + expect(markup).toContain('min-w-0 flex-1') + expect(markup).not.toContain('max-w-[9rem]') + }) +}) diff --git a/src/renderer/src/components/right-sidebar/source-control-branch-context-row.tsx b/src/renderer/src/components/right-sidebar/source-control-branch-context-row.tsx index e2c51b1d8..27d1183d5 100644 --- a/src/renderer/src/components/right-sidebar/source-control-branch-context-row.tsx +++ b/src/renderer/src/components/right-sidebar/source-control-branch-context-row.tsx @@ -25,7 +25,7 @@ function BaseRefButton({ return (