@@ -228,6 +228,16 @@ function rowFor(subject: string): HTMLElement {
228228 return row as HTMLElement ;
229229}
230230
231+ function prominentRefLabelsFor ( subject : string ) : string [ ] {
232+ return Array . from ( rowFor ( subject ) . querySelectorAll ( ".log-view__refs--prominent .log-view__ref-label" ) )
233+ . map ( label => label . textContent ?? "" ) ;
234+ }
235+
236+ function inlineRefLabelsFor ( subject : string ) : string [ ] {
237+ return Array . from ( rowFor ( subject ) . querySelectorAll ( ".log-view__meta .log-view__refs--inline .log-view__ref-label" ) )
238+ . map ( label => label . textContent ?? "" ) ;
239+ }
240+
231241function renderLog ( overrides : Partial < React . ComponentProps < typeof LogView > > = { } ) {
232242 const commits = overrides . commits ?? [ commit ( 1 ) , commit ( 2 ) , commit ( 3 ) ] ;
233243 const commitMarkers : CommitMarkers = {
@@ -426,7 +436,7 @@ describe("LogView commit selection", () => {
426436 expect ( rowFor ( "Subject 1" ) ) . toHaveTextContent ( "main" ) ;
427437 } ) ;
428438
429- it ( "keeps commit ref decorations compact " , ( ) => {
439+ it ( "shows up to four commit ref decorations before overflow " , ( ) => {
430440 renderLog ( {
431441 commits : [
432442 commit ( 1 , {
@@ -439,17 +449,16 @@ describe("LogView commit selection", () => {
439449 ] ,
440450 } ) ;
441451
442- expect ( rowFor ( "Subject 1" ) ) . toHaveTextContent ( "main" ) ;
443- expect ( rowFor ( "Subject 1" ) ) . toHaveTextContent ( "v1.0.0" ) ;
444- expect ( rowFor ( "Subject 1" ) ) . toHaveTextContent ( "+1" ) ;
445- expect ( rowFor ( "Subject 1" ) ) . not . toHaveTextContent ( "origin/main" ) ;
452+ expect ( prominentRefLabelsFor ( "Subject 1" ) ) . toEqual ( [ "main" , "origin/main" , "v1.0.0" ] ) ;
453+ expect ( rowFor ( "Subject 1" ) ) . not . toHaveTextContent ( "+1" ) ;
446454 } ) ;
447455
448- it ( "counts head and upstream markers in the compact ref limit " , ( ) => {
456+ it ( "renders selected checkout refs on a prominent ref line " , ( ) => {
449457 const targetCommit = commit ( 1 , {
450458 refDecorations : [
451459 { name : "main" , kind : "localBranch" } ,
452460 { name : "origin/main" , kind : "remoteBranch" } ,
461+ { name : "v1.0.0" , kind : "tag" } ,
453462 ] ,
454463 } ) ;
455464 renderLog ( {
@@ -461,28 +470,124 @@ describe("LogView commit selection", () => {
461470 } ,
462471 } ) ;
463472
464- const labels = Array . from ( rowFor ( "Subject 1" ) . querySelectorAll ( ".log-view__refs > span" ) )
465- . map ( label => label . textContent ) ;
473+ const row = rowFor ( "Subject 1" ) ;
474+ const refs = Array . from ( row . querySelectorAll ( ".log-view__refs--prominent > span" ) ) ;
466475
467- expect ( labels ) . toEqual ( [ "HEAD" , "origi..." , "+1" ] ) ;
468- expect ( screen . getByTitle ( "origin/main" ) ) . toBeInTheDocument ( ) ;
469- expect ( screen . getByTitle ( "1 more refs: main" ) ) . toBeInTheDocument ( ) ;
476+ expect ( prominentRefLabelsFor ( "Subject 1" ) ) . toEqual ( [ "HEAD" , "main" , "origin/main" , "v1.0.0" ] ) ;
477+ expect ( inlineRefLabelsFor ( "Subject 1" ) ) . toEqual ( [ ] ) ;
478+ expect ( refs . map ( ref => Array . from ( ref . classList ) ) ) . toEqual ( [
479+ expect . arrayContaining ( [ "log-view__ref--head" ] ) ,
480+ expect . arrayContaining ( [ "log-view__ref--localBranch" ] ) ,
481+ expect . arrayContaining ( [ "log-view__ref--upstream" ] ) ,
482+ expect . arrayContaining ( [ "log-view__ref--tag" ] ) ,
483+ ] ) ;
484+ expect ( screen . getByTitle ( "Current checkout" ) ) . toBeInTheDocument ( ) ;
485+ expect ( screen . getByTitle ( "Remote branch origin/main" ) ) . toBeInTheDocument ( ) ;
486+ expect ( row ) . not . toHaveTextContent ( "+1" ) ;
470487 } ) ;
471488
472- it ( "abbreviates long commit ref labels" , ( ) => {
489+ it ( "keeps unselected non-checkout refs inline in the meta row" , ( ) => {
490+ const targetCommit = commit ( 1 , {
491+ refDecorations : [
492+ { name : "main" , kind : "localBranch" } ,
493+ { name : "origin/main" , kind : "remoteBranch" } ,
494+ ] ,
495+ } ) ;
496+ const selectedCommit = commit ( 2 ) ;
497+
498+ renderLog ( {
499+ commits : [ targetCommit , selectedCommit ] ,
500+ selectedCommitHash : selectedCommit . hash ,
501+ } ) ;
502+
503+ expect ( inlineRefLabelsFor ( "Subject 1" ) ) . toEqual ( [ "main" , "origin/main" ] ) ;
504+ expect ( prominentRefLabelsFor ( "Subject 1" ) ) . toEqual ( [ ] ) ;
505+ } ) ;
506+
507+ it ( "keeps long remote ref labels visible and exposes the full label in the title" , ( ) => {
508+ const remoteName = "origin/feature/long-branch-label" ;
509+
473510 renderLog ( {
474511 commits : [
475512 commit ( 1 , {
476513 refDecorations : [
477- { name : "0.8.0-develop" , kind : "localBranch " } ,
514+ { name : remoteName , kind : "remoteBranch " } ,
478515 ] ,
479516 } ) ,
480517 ] ,
481518 } ) ;
482519
483- expect ( rowFor ( "Subject 1" ) ) . toHaveTextContent ( "0.8.0..." ) ;
484- expect ( rowFor ( "Subject 1" ) ) . not . toHaveTextContent ( "0.8.0-develop" ) ;
485- expect ( screen . getByTitle ( "Local branch 0.8.0-develop" ) ) . toBeInTheDocument ( ) ;
520+ expect ( prominentRefLabelsFor ( "Subject 1" ) ) . toEqual ( [ remoteName ] ) ;
521+ expect ( screen . getByTitle ( `Remote branch ${ remoteName } ` ) ) . toBeInTheDocument ( ) ;
522+ } ) ;
523+
524+ it ( "lists overflow refs in priority order" , ( ) => {
525+ const targetCommit = commit ( 1 , {
526+ refDecorations : [
527+ { name : "main" , kind : "localBranch" } ,
528+ { name : "release" , kind : "localBranch" } ,
529+ { name : "origin/main" , kind : "remoteBranch" } ,
530+ { name : "origin/feature-a" , kind : "remoteBranch" } ,
531+ { name : "v1.0.0" , kind : "tag" } ,
532+ { name : "v2.0.0" , kind : "tag" } ,
533+ ] ,
534+ } ) ;
535+
536+ renderLog ( {
537+ commits : [ targetCommit ] ,
538+ commitMarkers : {
539+ localHead : targetCommit . hash ,
540+ upstreamHead : null ,
541+ upstreamRef : null ,
542+ } ,
543+ } ) ;
544+
545+ expect ( prominentRefLabelsFor ( "Subject 1" ) ) . toEqual ( [ "HEAD" , "main" , "release" , "origin/feature-a" ] ) ;
546+ expect ( screen . getByTitle ( "3 more refs: origin/main, v1.0.0, v2.0.0" ) ) . toBeInTheDocument ( ) ;
547+ } ) ;
548+
549+ it ( "suppresses the duplicate upstream remote decoration on prominent ref rows" , ( ) => {
550+ const targetCommit = commit ( 1 , {
551+ refDecorations : [
552+ { name : "main" , kind : "localBranch" } ,
553+ { name : "origin/main" , kind : "remoteBranch" } ,
554+ ] ,
555+ } ) ;
556+
557+ renderLog ( {
558+ commits : [ targetCommit ] ,
559+ commitMarkers : {
560+ localHead : targetCommit . hash ,
561+ upstreamHead : targetCommit . hash ,
562+ upstreamRef : "origin/main" ,
563+ } ,
564+ } ) ;
565+
566+ expect ( prominentRefLabelsFor ( "Subject 1" ) ) . toEqual ( [ "HEAD" , "main" , "origin/main" ] ) ;
567+ expect ( rowFor ( "Subject 1" ) ) . not . toHaveTextContent ( "+1" ) ;
568+ } ) ;
569+
570+ it ( "suppresses the duplicate upstream remote decoration on inline ref rows" , ( ) => {
571+ const targetCommit = commit ( 1 , {
572+ refDecorations : [
573+ { name : "main" , kind : "localBranch" } ,
574+ { name : "origin/main" , kind : "remoteBranch" } ,
575+ ] ,
576+ } ) ;
577+ const selectedCommit = commit ( 2 ) ;
578+
579+ renderLog ( {
580+ commits : [ targetCommit , selectedCommit ] ,
581+ selectedCommitHash : selectedCommit . hash ,
582+ commitMarkers : {
583+ localHead : null ,
584+ upstreamHead : targetCommit . hash ,
585+ upstreamRef : "origin/main" ,
586+ } ,
587+ } ) ;
588+
589+ expect ( inlineRefLabelsFor ( "Subject 1" ) ) . toEqual ( [ "main" , "origin/main" ] ) ;
590+ expect ( prominentRefLabelsFor ( "Subject 1" ) ) . toEqual ( [ ] ) ;
486591 } ) ;
487592
488593 it ( "renders an explicit load more footer instead of wiring automatic end reached loading" , ( ) => {
0 commit comments