port(gitea): Retain issue/pull sort type (#8067)
Some checks are pending
/ release (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions

port of [gitea#34559](https://github.com/go-gitea/gitea/pull/34559)

initial work attributed to [badhezi](https://github.com/badhezi)

Co-authored-by: badhezi <zlilaharon@gmail.com>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8067
Reviewed-by: Beowulf <beowulf@beocode.eu>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
This commit is contained in:
Shiny Nematoda 2025-06-06 15:30:52 +02:00 committed by Gusted
parent 8f2c08b8dc
commit 82e4ccc223
2 changed files with 42 additions and 0 deletions

View file

@ -1438,6 +1438,47 @@ func TestIssueCount(t *testing.T) {
assert.Contains(t, allCount, "2\u00a0All")
}
func TestIssueDefaultValues(t *testing.T) {
defer tests.PrepareTestEnv(t)()
links := []string{"/user2/repo1/issues", "/user2/repo1/pulls"}
values := []url.Values{
{
"type": {"created_by"},
},
{
"poster": {"1"},
},
{
"sort": {"latest"},
},
{
"type": {"all"},
"sort": {"latest"},
"poster": {"1"},
},
{
"type": {"assigned"},
"sort": {"oldest"},
"poster": {"1"},
},
}
for _, link := range links {
t.Run(link[13:], func(t *testing.T) {
for _, value := range values {
req := NewRequestf(t, "GET", "%s?%s", link, value.Encode())
resp := MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
for name := range value {
assert.Equal(t, value.Get(name), htmlDoc.GetInputValueByName(name))
}
}
})
}
}
func TestIssuePostersSearch(t *testing.T) {
defer tests.PrepareTestEnv(t)()