From 1d961495f30a888d3c9301fc529bfdd7f0a67c04 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Mon, 14 Oct 2024 19:24:56 +0200 Subject: [PATCH 1/4] 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) +} From c3cc4d82ec2be23a0769fd7cbb57e4c6e49b83d1 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Mon, 14 Oct 2024 20:15:40 +0200 Subject: [PATCH 2/4] Use assert.Empty --- tests/integration/milestone_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/milestone_test.go b/tests/integration/milestone_test.go index 8e07a0232b..6bcf7d7128 100644 --- a/tests/integration/milestone_test.go +++ b/tests/integration/milestone_test.go @@ -38,5 +38,5 @@ func TestMilestonesCount(t *testing.T) { 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) + assert.Empty(t, htmlDoc.doc.Find("a[data-test-name='closed-issue-count']").Nodes) } From 698d7596828a3582cf961fae7f453fff15eea945 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Mon, 14 Oct 2024 22:23:14 +0200 Subject: [PATCH 3/4] Fix test --- tests/integration/milestone_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/milestone_test.go b/tests/integration/milestone_test.go index 6bcf7d7128..2a01786dc0 100644 --- a/tests/integration/milestone_test.go +++ b/tests/integration/milestone_test.go @@ -38,5 +38,5 @@ func TestMilestonesCount(t *testing.T) { 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='closed-issue-count']").Nodes) + assert.Empty(t, htmlDoc.doc.Find("a[data-test-name='allissue-count']").Nodes) } From 75ce0bf06bef4b15372213cb0e77cfedb62d6a84 Mon Sep 17 00:00:00 2001 From: JakobDev Date: Mon, 28 Oct 2024 17:37:24 +0100 Subject: [PATCH 4/4] Fix test --- tests/integration/milestone_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/milestone_test.go b/tests/integration/milestone_test.go index 2a01786dc0..0a475e0967 100644 --- a/tests/integration/milestone_test.go +++ b/tests/integration/milestone_test.go @@ -38,5 +38,5 @@ func TestMilestonesCount(t *testing.T) { 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='allissue-count']").Nodes) + assert.Empty(t, htmlDoc.doc.Find("a[data-test-name='all-issue-count']").Nodes) }