mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
9f22bc4414
commit
9c3143c45a
2 changed files with 11 additions and 3 deletions
|
@ -19,6 +19,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
|
"github.com/gohugoio/hugo/common/hugo"
|
||||||
"github.com/gohugoio/hugo/config"
|
"github.com/gohugoio/hugo/config"
|
||||||
|
|
||||||
"github.com/spf13/cast"
|
"github.com/spf13/cast"
|
||||||
|
@ -194,7 +195,14 @@ func (p *Paginator) Pagers() pagers {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PageSize returns the size of each paginator page.
|
// PageSize returns the size of each paginator page.
|
||||||
|
// Deprecated: Use PagerSize instead.
|
||||||
func (p *Paginator) PageSize() int {
|
func (p *Paginator) PageSize() int {
|
||||||
|
hugo.Deprecate("PageSize", "Use PagerSize instead.", "v0.128.0")
|
||||||
|
return p.size
|
||||||
|
}
|
||||||
|
|
||||||
|
// PagerSize returns the size of each paginator page.
|
||||||
|
func (p *Paginator) PagerSize() int {
|
||||||
return p.size
|
return p.size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,7 +114,7 @@ func doTestPages(t *testing.T, paginator *Paginator) {
|
||||||
|
|
||||||
c.Assert(len(paginatorPages), qt.Equals, 5)
|
c.Assert(len(paginatorPages), qt.Equals, 5)
|
||||||
c.Assert(paginator.TotalNumberOfElements(), qt.Equals, 21)
|
c.Assert(paginator.TotalNumberOfElements(), qt.Equals, 21)
|
||||||
c.Assert(paginator.PageSize(), qt.Equals, 5)
|
c.Assert(paginator.PagerSize(), qt.Equals, 5)
|
||||||
c.Assert(paginator.TotalPages(), qt.Equals, 5)
|
c.Assert(paginator.TotalPages(), qt.Equals, 5)
|
||||||
|
|
||||||
first := paginatorPages[0]
|
first := paginatorPages[0]
|
||||||
|
@ -172,7 +172,7 @@ func doTestPagerNoPages(t *testing.T, paginator *Paginator) {
|
||||||
c := qt.New(t)
|
c := qt.New(t)
|
||||||
c.Assert(len(paginatorPages), qt.Equals, 1)
|
c.Assert(len(paginatorPages), qt.Equals, 1)
|
||||||
c.Assert(paginator.TotalNumberOfElements(), qt.Equals, 0)
|
c.Assert(paginator.TotalNumberOfElements(), qt.Equals, 0)
|
||||||
c.Assert(paginator.PageSize(), qt.Equals, 5)
|
c.Assert(paginator.PagerSize(), qt.Equals, 5)
|
||||||
c.Assert(paginator.TotalPages(), qt.Equals, 0)
|
c.Assert(paginator.TotalPages(), qt.Equals, 0)
|
||||||
|
|
||||||
// pageOne should be nothing but the first
|
// pageOne should be nothing but the first
|
||||||
|
@ -187,7 +187,7 @@ func doTestPagerNoPages(t *testing.T, paginator *Paginator) {
|
||||||
c.Assert(pageOne.TotalNumberOfElements(), qt.Equals, 0)
|
c.Assert(pageOne.TotalNumberOfElements(), qt.Equals, 0)
|
||||||
c.Assert(pageOne.TotalPages(), qt.Equals, 0)
|
c.Assert(pageOne.TotalPages(), qt.Equals, 0)
|
||||||
c.Assert(pageOne.PageNumber(), qt.Equals, 1)
|
c.Assert(pageOne.PageNumber(), qt.Equals, 1)
|
||||||
c.Assert(pageOne.PageSize(), qt.Equals, 5)
|
c.Assert(pageOne.PagerSize(), qt.Equals, 5)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestProbablyEqualPageLists(t *testing.T) {
|
func TestProbablyEqualPageLists(t *testing.T) {
|
||||||
|
|
Loading…
Reference in a new issue