Skip to content

Commit

Permalink
Add Model.GetFooterVisibility function (#152)
Browse files Browse the repository at this point in the history
This is analog to the GetHeaderVisibility function. Note that it only
reports if the footer should be visible, but if it has no contents it
won't be rendered.
  • Loading branch information
inkel authored Oct 9, 2023
1 parent e472e81 commit c8ef5b8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions table/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ func (m *Model) GetHeaderVisibility() bool {
return m.headerVisible
}

// GetFooterVisibility returns true if the footer has been set to
// visible (default) or false if the footer has been set to hidden.
// Note that even if the footer is visible it will only be rendered if
// it has contents.
func (m *Model) GetFooterVisibility() bool {
return m.footerVisible
}

// GetPaginationWrapping returns true if pagination wrapping is enabled, or false
// if disabled. If disabled, navigating through pages will stop at the first
// and last pages.
Expand Down
10 changes: 10 additions & 0 deletions table/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,16 @@ func TestGetHeaderVisibility(t *testing.T) {
assert.False(t, model.GetHeaderVisibility(), "Header was not set to hidden")
}

func TestGetFooterVisibility(t *testing.T) {
model := New([]Column{})

assert.True(t, model.GetFooterVisibility(), "Footer should be visible by default")

model = model.WithFooterVisibility(false)

assert.False(t, model.GetFooterVisibility(), "Footer was not set to hidden")
}

func TestGetPaginationWrapping(t *testing.T) {
model := New([]Column{})

Expand Down

0 comments on commit c8ef5b8

Please sign in to comment.