Merge pull request 'fix: regression from #4125' (#5560) from JakobDev/forgejo:linkfix into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5560
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
Otto 2024-10-31 02:30:38 +00:00
commit 698b1c07c4
2 changed files with 23 additions and 4 deletions

View file

@ -13,8 +13,10 @@
{{svg "octicon-check" 16 "tw-mr-2"}} {{svg "octicon-check" 16 "tw-mr-2"}}
{{ctx.Locale.PrettyNumber .ClosedCount}}&nbsp;{{ctx.Locale.Tr "repo.issues.closed_title"}} {{ctx.Locale.PrettyNumber .ClosedCount}}&nbsp;{{ctx.Locale.Tr "repo.issues.closed_title"}}
</a> </a>
<a class="{{if eq .State "all"}}active {{end}}item" href="{{.AllStatesLink}}" data-test-name="all-issue-count"> {{if not .PageIsMilestones}}
{{svg "octicon-eye" 16 "tw-mr-2"}} <a class="{{if eq .State "all"}}active {{end}}item" href="{{.AllStatesLink}}" data-test-name="all-issue-count">
{{ctx.Locale.PrettyNumber (.AllCount)}}&nbsp;{{ctx.Locale.Tr "repo.issues.all_title"}} {{svg "octicon-eye" 16 "tw-mr-2"}}
</a> {{ctx.Locale.PrettyNumber (.AllCount)}}&nbsp;{{ctx.Locale.Tr "repo.issues.all_title"}}
</a>
{{end}}
</div> </div>

View file

@ -23,3 +23,20 @@ func TestViewMilestones(t *testing.T) {
placeholder, _ := search.Attr("placeholder") placeholder, _ := search.Attr("placeholder")
assert.Equal(t, "Search milestones...", placeholder) assert.Equal(t, "Search milestones...", placeholder)
} }
func TestMilestonesCount(t *testing.T) {
defer tests.PrepareTestEnv(t)()
req := NewRequest(t, "GET", "/user2/repo1/milestones")
resp := MakeRequest(t, req, http.StatusOK)
htmlDoc := NewHTMLParser(t, resp.Body)
openCount := htmlDoc.doc.Find("a[data-test-name='open-issue-count']").Text()
assert.Contains(t, openCount, "2\u00a0Open")
closedCount := htmlDoc.doc.Find("a[data-test-name='closed-issue-count']").Text()
assert.Contains(t, closedCount, "1\u00a0Closed")
assert.Empty(t, htmlDoc.doc.Find("a[data-test-name='all-issue-count']").Nodes)
}