From 28ceec6fadbcb82bc02a6530ab35732793f7230c Mon Sep 17 00:00:00 2001 From: 0ko <0ko@noreply.codeberg.org> Date: Fri, 28 Jun 2024 16:28:03 +0000 Subject: [PATCH] ui: fix wrong string used in a search box (#4258) Resolves https://codeberg.org/forgejo/forgejo/issues/4256. Fixes regression caused by https://github.com/go-gitea/gitea/pull/29530/files#diff-b46ae540c8eb41d1ccaa1659489fcc47d72eee4c4f04dc83c5ccf4d6d1a3395eR45. Preview: Before - https://codeberg.org/forgejo/forgejo/attachments/d629f2e9-0d07-4719-9250-52d3ba9f4a9e After - https://codeberg.org/forgejo/forgejo/attachments/6a5f5cb2-124d-4673-a387-8483125a89eb Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4258 Reviewed-by: Earl Warren Reviewed-by: Otto --- release-notes/8.0.0/fix/4258.md | 1 + templates/repo/settings/collaboration.tmpl | 2 +- tests/integration/repo_collaborator_test.go | 37 +++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 release-notes/8.0.0/fix/4258.md create mode 100644 tests/integration/repo_collaborator_test.go diff --git a/release-notes/8.0.0/fix/4258.md b/release-notes/8.0.0/fix/4258.md new file mode 100644 index 0000000000..c8f7646d91 --- /dev/null +++ b/release-notes/8.0.0/fix/4258.md @@ -0,0 +1 @@ +Fix wrong placeholder text in the form for adding repository collaborator diff --git a/templates/repo/settings/collaboration.tmpl b/templates/repo/settings/collaboration.tmpl index ed4d5e7eb3..8028642a7d 100644 --- a/templates/repo/settings/collaboration.tmpl +++ b/templates/repo/settings/collaboration.tmpl @@ -42,7 +42,7 @@
{{.CsrfTokenHtml}}
diff --git a/tests/integration/repo_collaborator_test.go b/tests/integration/repo_collaborator_test.go new file mode 100644 index 0000000000..beeb950f5a --- /dev/null +++ b/tests/integration/repo_collaborator_test.go @@ -0,0 +1,37 @@ +// Copyright 2024 The Forgejo Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package integration + +import ( + "net/http" + "net/url" + "strings" + "testing" + + "github.com/stretchr/testify/assert" +) + +// TestRepoCollaborators is a test for contents of Collaborators tab in the repo settings +// It only covers a few elements and can be extended as needed +func TestRepoCollaborators(t *testing.T) { + onGiteaRun(t, func(t *testing.T, u *url.URL) { + session := loginUser(t, "user2") + + // Visit Collaborators tab of repo settings + response := session.MakeRequest(t, NewRequest(t, "GET", "/user2/repo1/settings/collaboration"), http.StatusOK) + page := NewHTMLParser(t, response.Body).Find(".repo-setting-content") + + // Veirfy header + assert.EqualValues(t, "Collaborators", strings.TrimSpace(page.Find("h4").Text())) + + // Veirfy button text + page = page.Find("#repo-collab-form") + assert.EqualValues(t, "Add collaborator", strings.TrimSpace(page.Find("button.primary").Text())) + + // Veirfy placeholder + placeholder, exists := page.Find("#search-user-box input").Attr("placeholder") + assert.True(t, exists) + assert.EqualValues(t, "Search users...", placeholder) + }) +}