mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-17 07:22:42 +00:00
feat(i18n): allow different translations of creation links and titles (#4829)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4829 Reviewed-by: Gusted <gusted@noreply.codeberg.org>
This commit is contained in:
parent
690b63fc74
commit
bad3b32037
13 changed files with 115 additions and 15 deletions
|
@ -5,9 +5,13 @@ package integration
|
|||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/modules/translation"
|
||||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// This test makes sure that organization members are able to navigate between `/<orgname>` and `/org/<orgname>/<section>` freely.
|
||||
|
@ -19,6 +23,8 @@ import (
|
|||
func TestOrgNavigationDashboard(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
locale := translation.NewLocale("en-US")
|
||||
|
||||
// Login as the future organization admin and create an organization
|
||||
session1 := loginUser(t, "user2")
|
||||
session1.MakeRequest(t, NewRequestWithValues(t, "POST", "/org/create", map[string]string{
|
||||
|
@ -33,6 +39,11 @@ func TestOrgNavigationDashboard(t *testing.T) {
|
|||
doc := NewHTMLParser(t, resp.Body)
|
||||
doc.AssertElement(t, "#org-info a[href='/org/org_navigation_test/dashboard']", true)
|
||||
|
||||
// Verify the "New repository" and "New migration" buttons
|
||||
links := doc.Find(".organization.profile .grid .column .center")
|
||||
assert.EqualValues(t, locale.TrString("new_repo.link"), strings.TrimSpace(links.Find("a[href^='/repo/create?org=']").Text()))
|
||||
assert.EqualValues(t, locale.TrString("new_migrate.link"), strings.TrimSpace(links.Find("a[href^='/repo/migrate?org=']").Text()))
|
||||
|
||||
// Check if the "View <orgname>" button is available on dashboard for the org admin (member)
|
||||
resp = session1.MakeRequest(t, NewRequest(t, "GET", "/org/org_navigation_test/dashboard"), http.StatusOK)
|
||||
doc = NewHTMLParser(t, resp.Body)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue