diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index fdc2355fe8..c18efe8e66 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -180,6 +180,7 @@ commit_kind = Search commits... runner_kind = Search runners... no_results = No matching results found. issue_kind = Search issues... +milestone_kind = Search milestones... pull_kind = Search pulls... keyword_search_unavailable = Searching by keyword is currently not available. Please contact the site administrator. diff --git a/templates/repo/issue/search.tmpl b/templates/repo/issue/search.tmpl index 007fe41920..f1c0ea3290 100644 --- a/templates/repo/issue/search.tmpl +++ b/templates/repo/issue/search.tmpl @@ -11,6 +11,8 @@ {{end}} {{if .PageIsPullList}} {{template "shared/search/combo_fuzzy" dict "Value" .Keyword "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.pull_kind") "Tooltip" (ctx.Locale.Tr "explore.go_to")}} + {{else if .PageIsMilestones}} + {{template "shared/search/combo_fuzzy" dict "Value" .Keyword "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.milestone_kind") "Tooltip" (ctx.Locale.Tr "explore.go_to")}} {{else}} {{template "shared/search/combo_fuzzy" dict "Value" .Keyword "IsFuzzy" .IsFuzzy "Placeholder" (ctx.Locale.Tr "search.issue_kind") "Tooltip" (ctx.Locale.Tr "explore.go_to")}} {{end}} diff --git a/tests/integration/issue_test.go b/tests/integration/issue_test.go index 83b75853ab..ccae0b00ea 100644 --- a/tests/integration/issue_test.go +++ b/tests/integration/issue_test.go @@ -70,6 +70,18 @@ func TestNoLoginViewIssues(t *testing.T) { MakeRequest(t, req, http.StatusOK) } +func TestViewIssues(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + req := NewRequest(t, "GET", "/user2/repo1/issues") + resp := MakeRequest(t, req, http.StatusOK) + + htmlDoc := NewHTMLParser(t, resp.Body) + search := htmlDoc.doc.Find(".list-header-search > .search > .input > input") + placeholder, _ := search.Attr("placeholder") + assert.Equal(t, "Search issues...", placeholder) +} + func TestViewIssuesSortByType(t *testing.T) { defer tests.PrepareTestEnv(t)() diff --git a/tests/integration/milestone_test.go b/tests/integration/milestone_test.go new file mode 100644 index 0000000000..ba46740a19 --- /dev/null +++ b/tests/integration/milestone_test.go @@ -0,0 +1,25 @@ +// Copyright 2024 The Forgejo Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package integration + +import ( + "net/http" + "testing" + + "code.gitea.io/gitea/tests" + + "github.com/stretchr/testify/assert" +) + +func TestViewMilestones(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) + search := htmlDoc.doc.Find(".list-header-search > .search > .input > input") + placeholder, _ := search.Attr("placeholder") + assert.Equal(t, "Search milestones...", placeholder) +} diff --git a/tests/integration/pull_test.go b/tests/integration/pull_test.go new file mode 100644 index 0000000000..ef21c7f533 --- /dev/null +++ b/tests/integration/pull_test.go @@ -0,0 +1,25 @@ +// Copyright 2024 The Forgejo Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package integration + +import ( + "net/http" + "testing" + + "code.gitea.io/gitea/tests" + + "github.com/stretchr/testify/assert" +) + +func TestViewPulls(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + req := NewRequest(t, "GET", "/user2/repo1/pulls") + resp := MakeRequest(t, req, http.StatusOK) + + htmlDoc := NewHTMLParser(t, resp.Body) + search := htmlDoc.doc.Find(".list-header-search > .search > .input > input") + placeholder, _ := search.Attr("placeholder") + assert.Equal(t, "Search pulls...", placeholder) +}