diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-03-04 09:02:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 01:02:51 +0000 |
commit | 8553b4600e3035b6f6ad6907c37cebd013fa4d64 (patch) | |
tree | 110ec9003d7966549d427a52af15ba1b02f3324a /routers/web/user | |
parent | 77e29e0c39392f142627303bd798fb55258072b2 (diff) | |
download | gitea-8553b4600e3035b6f6ad6907c37cebd013fa4d64.tar.gz gitea-8553b4600e3035b6f6ad6907c37cebd013fa4d64.zip |
Add an trailing slash to dashboard links (#29555)
Fix #29533, and add some tests for "base/paginate.tmpl"
Diffstat (limited to 'routers/web/user')
-rw-r--r-- | routers/web/user/home_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/routers/web/user/home_test.go b/routers/web/user/home_test.go index 3f5fd26689..1cc9886308 100644 --- a/routers/web/user/home_test.go +++ b/routers/web/user/home_test.go @@ -11,6 +11,8 @@ import ( repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/templates" + "code.gitea.io/gitea/services/context" "code.gitea.io/gitea/services/contexttest" "github.com/stretchr/testify/assert" @@ -113,3 +115,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.RenderToHTML("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.RenderToHTML("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">`) +} |