@@ -452,6 +452,33 @@ func TestModel_LineNumbersFromConfig(t *testing.T) {
452452 })
453453}
454454
455+ func TestModel_BlameFromConfig (t * testing.T ) {
456+ renderer := & mocks.RendererMock {
457+ ChangedFilesFunc : func (string , bool ) ([]string , error ) { return nil , nil },
458+ FileDiffFunc : func (string , string , bool ) ([]diff.DiffLine , error ) { return nil , nil },
459+ }
460+ store := annotation .NewStore ()
461+ blamer := & mocks.BlamerMock {
462+ FileBlameFunc : func (string , string , bool ) (map [int ]diff.BlameLine , error ) { return map [int ]diff.BlameLine {}, nil },
463+ }
464+
465+ t .Run ("blame enabled via config when blamer is available" , func (t * testing.T ) {
466+ m := NewModel (renderer , store , noopHighlighter (), ModelConfig {ShowBlame : true , Blamer : blamer , TreeWidthRatio : 2 })
467+ assert .True (t , m .showBlame )
468+ })
469+
470+ t .Run ("blame disabled without blamer even if requested" , func (t * testing.T ) {
471+ m := NewModel (renderer , store , noopHighlighter (), ModelConfig {ShowBlame : true , TreeWidthRatio : 2 })
472+ assert .False (t , m .showBlame )
473+ })
474+
475+ t .Run ("blame disabled by default" , func (t * testing.T ) {
476+ m := NewModel (renderer , store , noopHighlighter (), ModelConfig {Blamer : blamer , TreeWidthRatio : 2 })
477+ assert .False (t , m .showBlame )
478+ })
479+ }
480+
481+
455482func TestModel_StatusModeIcons (t * testing.T ) {
456483 t .Run ("all icons always present" , func (t * testing.T ) {
457484 m := testModel (nil , nil )
@@ -6970,6 +6997,14 @@ func TestModel_StatusModeIconsLineNumbers(t *testing.T) {
69706997 assert .Contains (t , icons , "#" )
69716998}
69726999
7000+ func TestModel_StatusModeIconsBlame (t * testing.T ) {
7001+ m := testModel (nil , nil )
7002+ m .showBlame = true
7003+ icons := m .statusModeIcons ()
7004+ assert .Contains (t , icons , "b" )
7005+ assert .NotContains (t , icons , "@" )
7006+ }
7007+
69737008func TestModel_HelpOverlayContainsLineNumbers (t * testing.T ) {
69747009 m := testModel (nil , nil )
69757010 m .width = 120
0 commit comments