mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 06:03:51 +03:00
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:
parent
50ded8da59
commit
c92b4b12c8
2 changed files with 37 additions and 1 deletions
|
@ -148,7 +148,7 @@
|
|||
<div class="menu">
|
||||
<a rel="nofollow" class="{{if or (eq .SortType "relevance") (not .SortType)}}active {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort=relevency&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_sort.relevance"}}</a>
|
||||
{{$o := .}}
|
||||
{{range $opt := StringUtils.Make "latest" "oldest" "recentupdate" "mostcomment" "leastcomment" "nearduedate" "farduedate"}}
|
||||
{{range $opt := StringUtils.Make "latest" "oldest" "recentupdate" "leastupdate" "mostcomment" "leastcomment" "nearduedate" "farduedate"}}
|
||||
{{$text := ctx.Locale.Tr (printf "repo.issues.filter_sort.%s" $opt)}}
|
||||
<a rel="nofollow" class="{{if eq $o.SortType $opt}}active {{end}}item" href="?q={{$.Keyword}}&type={{$.ViewType}}&sort={{$opt}}&state={{$.State}}&labels={{$o.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}&fuzzy={{$.IsFuzzy}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{$text}}</a>
|
||||
{{end}}
|
||||
|
|
|
@ -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)()
|
||||
|
||||
|
|
Loading…
Reference in a new issue