1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-23 08:47:42 -05:00

Merge pull request '[v7.0/forgejo] Fix wrong string used in a search box' (#4261) from bp-v7.0/forgejo-28ceec6 into v7.0/forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4261
Reviewed-by: Otto <otto@codeberg.org>
This commit is contained in:
Earl Warren 2024-06-29 07:30:12 +00:00
commit 65a89ce6be
3 changed files with 39 additions and 1 deletions

View file

@ -0,0 +1 @@
Fix wrong placeholder text in the form for adding repository collaborator

View file

@ -42,7 +42,7 @@
<form class="ui form" id="repo-collab-form" action="{{.Link}}" method="post">
{{.CsrfTokenHtml}}
<div id="search-user-box" class="ui search input tw-align-middle">
<input class="prompt" name="collaborator" placeholder="{{ctx.Locale.Tr "search.team_kind"}}" autocomplete="off" autofocus required>
<input class="prompt" name="collaborator" placeholder="{{ctx.Locale.Tr "search.user_kind"}}" autocomplete="off" autofocus required>
</div>
<button class="ui primary button">{{ctx.Locale.Tr "repo.settings.add_collaborator"}}</button>
</form>

View file

@ -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)
})
}