diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2024-03-04 13:50:55 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 13:50:55 +0800 |
commit | 4ef7e496b878911fd82f9036bde886ca725c4449 (patch) | |
tree | 8f446d086796fe2b091a35d0c109cea6b865e0c8 /routers | |
parent | b519e4750b9504ce7b89861e2ebe94edc8187372 (diff) | |
download | gitea-4ef7e496b878911fd82f9036bde886ca725c4449.tar.gz gitea-4ef7e496b878911fd82f9036bde886ca725c4449.zip |
Add a trailing slash to dashboard links (#29555) (#29573)
Backport #29555
Diffstat (limited to 'routers')
-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 1eb1fad057..418dac7bb3 100644 --- a/routers/web/user/home_test.go +++ b/routers/web/user/home_test.go @@ -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">`) +} |