fix: Re-add least recently updated as sort order

Regression from https://codeberg.org/forgejo/forgejo/pulls/5819
Integration test added (my first! 🎉)
This commit is contained in:
Otto Richter 2024-11-11 01:26:32 +01:00
parent 50ded8da59
commit c92b4b12c8
2 changed files with 37 additions and 1 deletions

View file

@ -1048,6 +1048,42 @@ func TestFileHistoryPager(t *testing.T) {
})
}
func TestRepoIssueSorting(t *testing.T) {
defer tests.PrepareTestEnv(t)()
t.Run("Dropdown content", func(t *testing.T) {
defer tests.PrintCurrentTest(t)()
req := NewRequest(t, "GET", "/user2/repo1/issues")
resp := MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
assert.Equal(t,
9,
htmlDoc.Find(`.list-header-sort .menu a`).Length(),
"Wrong amount of sort options in dropdown")
menuItemsHTML := htmlDoc.Find(`.list-header-sort .menu`).Text()
locale := translation.NewLocale("en-US")
for _, key := range []string{
"relevance",
"latest",
"oldest",
"recentupdate",
"leastupdate",
"mostcomment",
"leastcomment",
"nearduedate",
"farduedate",
} {
assert.Contains(t,
menuItemsHTML,
locale.Tr("repo.issues.filter_sort."+key),
"Sort option %s ('%s') not found in dropdown", key, locale.Tr("repo.issues.filter_sort."+key))
}
})
}
func TestRepoIssueFilterLinks(t *testing.T) {
defer tests.PrepareTestEnv(t)()