1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-03 09:07:19 +00:00

Remove unnecessary ".Link" usages (#29909)

In HTML, `?key=val` already means "use the current link with new query parameters"
This commit is contained in:
wxiaoguang
2024-03-20 13:56:42 +08:00
committed by GitHub
parent 35cfd98e12
commit 4c476fa41d
19 changed files with 108 additions and 108 deletions

View File

@ -16,17 +16,17 @@ func TestExploreUser(t *testing.T) {
defer tests.PrepareTestEnv(t)()
cases := []struct{ sortOrder, expected string }{
{"", "/explore/users?sort=newest&q="},
{"newest", "/explore/users?sort=newest&q="},
{"oldest", "/explore/users?sort=oldest&q="},
{"alphabetically", "/explore/users?sort=alphabetically&q="},
{"reversealphabetically", "/explore/users?sort=reversealphabetically&q="},
{"", "?sort=newest&q="},
{"newest", "?sort=newest&q="},
{"oldest", "?sort=oldest&q="},
{"alphabetically", "?sort=alphabetically&q="},
{"reversealphabetically", "?sort=reversealphabetically&q="},
}
for _, c := range cases {
req := NewRequest(t, "GET", "/explore/users?sort="+c.sortOrder)
resp := MakeRequest(t, req, http.StatusOK)
h := NewHTMLParser(t, resp.Body)
href, _ := h.Find(`.ui.dropdown .menu a.active.item[href^="/explore/users"]`).Attr("href")
href, _ := h.Find(`.ui.dropdown .menu a.active.item[href^="?sort="]`).Attr("href")
assert.Equal(t, c.expected, href)
}