mirror of
https://github.com/go-gitea/gitea
synced 2025-07-03 09:07:19 +00:00
Backport #29555
This commit is contained in:
@ -10,8 +10,10 @@ import (
|
||||
"code.gitea.io/gitea/models/db"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/contexttest"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/templates"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@ -117,3 +119,18 @@ func TestMilestonesForSpecificRepo(t *testing.T) {
|
||||
assert.Len(t, ctx.Data["Milestones"], 1)
|
||||
assert.Len(t, ctx.Data["Repos"], 2) // both repo 42 and 1 have milestones and both are owned by user 2
|
||||
}
|
||||
|
||||
func TestDashboardPagination(t *testing.T) {
|
||||
ctx, _ := contexttest.MockContext(t, "/", contexttest.MockContextOption{Render: templates.HTMLRenderer()})
|
||||
page := context.NewPagination(10, 3, 1, 3)
|
||||
|
||||
setting.AppSubURL = "/SubPath"
|
||||
out, err := ctx.RenderToString("base/paginate", map[string]any{"Link": setting.AppSubURL, "Page": page})
|
||||
assert.NoError(t, err)
|
||||
assert.Contains(t, out, `<a class=" item navigation" href="/SubPath/?page=2">`)
|
||||
|
||||
setting.AppSubURL = ""
|
||||
out, err = ctx.RenderToString("base/paginate", map[string]any{"Link": setting.AppSubURL, "Page": page})
|
||||
assert.NoError(t, err)
|
||||
assert.Contains(t, out, `<a class=" item navigation" href="/?page=2">`)
|
||||
}
|
||||
|
Reference in New Issue
Block a user