From 1d961495f30a888d3c9301fc529bfdd7f0a67c04 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Mon, 14 Oct 2024 19:24:56 +0200 Subject: [PATCH] fix: regression from #4125 --- templates/repo/issue/openclose.tmpl | 10 ++++++---- tests/integration/milestone_test.go | 17 +++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) 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) +}