Skip to content

Commit

Permalink
Tests for titles
Browse files Browse the repository at this point in the history
  • Loading branch information
Evertras committed Jan 27, 2024
1 parent 723948d commit 39aa4fd
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/panes/panes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,25 @@ func TestViewVerticalGoesTopToBottom(t *testing.T) {

assert.True(t, indexTop < indexBottom, "Top child should be before bottom child")
}

func TestViewTitleIsShown(t *testing.T) {
const expectedView = `╭╮title╭─╮
│testing │
╰────────╯`
dummy := newDummyModel("testing", nil, nil)
pane := panes.NewLeaf(dummy).WithName("title").WithDimensions(10, 3)

assert.Equal(t, expectedView, pane.View())
}

func TestViewRemovingTitleShowsBorderProperly(t *testing.T) {
const expectedView = `╭────────╮
│testing │
╰────────╯`
dummy := newDummyModel("testing", nil, nil)
pane := panes.NewLeaf(dummy).WithName("title").WithDimensions(10, 3)

pane = pane.WithName("")

assert.Equal(t, expectedView, pane.View())
}

0 comments on commit 39aa4fd

Please sign in to comment.