diff --git a/templates/repo/issue/openclose.tmpl b/templates/repo/issue/openclose.tmpl index 5de1d1f639..4c2d69355b 100644 --- a/templates/repo/issue/openclose.tmpl +++ b/templates/repo/issue/openclose.tmpl @@ -13,8 +13,10 @@ {{svg "octicon-check" 16 "tw-mr-2"}} {{ctx.Locale.PrettyNumber .ClosedCount}} {{ctx.Locale.Tr "repo.issues.closed_title"}} - - {{svg "octicon-eye" 16 "tw-mr-2"}} - {{ctx.Locale.PrettyNumber (.AllCount)}} {{ctx.Locale.Tr "repo.issues.all_title"}} - + {{if not .PageIsMilestones}} + + {{svg "octicon-eye" 16 "tw-mr-2"}} + {{ctx.Locale.PrettyNumber (.AllCount)}} {{ctx.Locale.Tr "repo.issues.all_title"}} + + {{end}} diff --git a/tests/integration/milestone_test.go b/tests/integration/milestone_test.go index ba46740a19..8e07a0232b 100644 --- a/tests/integration/milestone_test.go +++ b/tests/integration/milestone_test.go @@ -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) +}