fix(git): keep the 仓库 caption beside the graph-toolbar picker
The relocated picker dropped its visible 仓库 caption, which left the first box of the scope row as a bare repository name. Restore the caption at the section-header type and pin it with an assertion.
This commit is contained in:
1 parent
54fa7a56ef
commit
da860d9aef
3 files changed
+7
-1
No files matched your search
@@ -370,6 +370,7 @@ export function GitGraphSection({ scope, worktree, visible, refreshTick = 0, onP
|
||||
<div className={css.toolbar}>
|
||||
{repoPicker && (
|
||||
<label className={css.repoPick} data-scm-repos>
|
||||
<span className={css.repoPickLabel}>{t('gitRepository')}</span>
|
||||
<select className={css.select} aria-label={t('gitRepository')}
|
||||
value={repoPicker.value} disabled={repoPicker.disabled}
|
||||
onChange={event => { repoPicker.onChooseRepo(event.target.value) }}>
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
/* The multi-repo picker slots in ahead of the branch filter so the toolbar
|
||||
reads as one scope row — root first, then its history filter. The slot
|
||||
flexes like .select, so both boxes share the row instead of stacking. */
|
||||
.repoPick { flex: 1; min-width: 0; display: flex; }
|
||||
.repoPick { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
|
||||
.repoPickLabel { flex: none; white-space: nowrap; font: var(--dsw-font-xxs-strong-12); color: var(--dsw-alias-label-primary); }
|
||||
.hint { color: var(--dsw-alias-label-secondary); font: var(--dsw-font-xxxs-11); }
|
||||
.scroll { flex: 1; min-height: 0; overflow: auto; }
|
||||
/* A commit row is ONE 28px line — rail, ref pills, subject (the GitLens-style
|
||||
|
||||
@@ -85,6 +85,10 @@ it('lists every discovered repository and re-pins the scope through the picker',
|
||||
// the base itself stays short.
|
||||
expect(options(node).map(option => option.textContent)).toEqual(['work', 'work-admin (C:\\)', 'work-docs (C:\\)'])
|
||||
expect(node.value).toBe(CWD)
|
||||
// The scope caption reads in front of the picker, ahead of the branch filter.
|
||||
const caption = node.closest('[data-scm-repos]')!.firstElementChild
|
||||
expect(caption?.tagName).toBe('SPAN')
|
||||
expect(caption?.textContent).toBe(t('gitRepository'))
|
||||
|
||||
await act(async () => { node.value = ADMIN; node.dispatchEvent(new Event('change', { bubbles: true })) })
|
||||
await flush()
|
||||
|
||||
Reference in new issue
Block a user