mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-19 22:48:32 +00:00
feat(ui): add "follow rename" to file commit history list (#34994)
Fix #28253 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
@@ -33,8 +33,8 @@ func NewPagination(total int64, pagingNum, current, numPages int) *Pagination {
|
||||
return p
|
||||
}
|
||||
|
||||
func (p *Pagination) WithCurRows(n int) *Pagination {
|
||||
p.Paginater.SetCurRows(n)
|
||||
func (p *Pagination) WithUnlimitedPaging(curRows int, hasNext bool) *Pagination {
|
||||
p.Paginater.SetUnlimitedPaging(curRows, hasNext)
|
||||
return p
|
||||
}
|
||||
|
||||
|
||||
@@ -32,4 +32,24 @@ func TestPagination(t *testing.T) {
|
||||
params.Del("foo")
|
||||
v, _ = url.ParseQuery(string(p.GetParams()))
|
||||
assert.Equal(t, params, v)
|
||||
|
||||
p = NewPagination(-1, 1, 1, 1)
|
||||
p.WithUnlimitedPaging(0, false)
|
||||
assert.Zero(t, p.Paginater.TotalPages())
|
||||
assert.False(t, p.Paginater.HasNext())
|
||||
|
||||
p = NewPagination(-1, 1, 1, 1)
|
||||
p.WithUnlimitedPaging(10, false)
|
||||
assert.Equal(t, 1, p.Paginater.TotalPages()) // first page, no next, so it should know that the total page number is 1
|
||||
assert.False(t, p.Paginater.HasNext())
|
||||
|
||||
p = NewPagination(-1, 1, 2, 1)
|
||||
p.WithUnlimitedPaging(10, false)
|
||||
assert.Equal(t, -1, p.Paginater.TotalPages())
|
||||
assert.False(t, p.Paginater.HasNext())
|
||||
|
||||
p = NewPagination(-1, 1, 1, 1)
|
||||
p.WithUnlimitedPaging(10, true)
|
||||
assert.Equal(t, -1, p.Paginater.TotalPages())
|
||||
assert.True(t, p.Paginater.HasNext())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user