fix: regression from #4125

This commit is contained in:
JakobDev 2024-10-14 19:24:56 +02:00
parent 6f7aee2b3e
commit 1d961495f3
No known key found for this signature in database
GPG key ID: 39DEF62C3ED6DC4C
2 changed files with 23 additions and 4 deletions

View file

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

View file

@ -23,3 +23,20 @@ func TestViewMilestones(t *testing.T) {
placeholder, _ := search.Attr("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.Len(t, htmlDoc.doc.Find("a[data-test-name='closed-issue-count']").Nodes, 0)
}