mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-31 11:52:10 +00:00
feat(ui): make JS asset load error message translatable (#7388)
Some checks failed
/ release (push) Waiting to run
testing / backend-checks (push) Has been skipped
testing / frontend-checks (push) Has been skipped
testing / test-unit (push) Has been skipped
testing / test-e2e (push) Has been skipped
testing / test-mysql (push) Has been skipped
testing / test-pgsql (push) Has been skipped
testing / test-sqlite (push) Has been skipped
testing / test-remote-cacher (redis) (push) Has been skipped
testing / test-remote-cacher (valkey) (push) Has been skipped
testing / test-remote-cacher (garnet) (push) Has been skipped
testing / test-remote-cacher (redict) (push) Has been skipped
testing / security-check (push) Has been skipped
Integration tests for the release process / release-simulation (push) Has been cancelled
Some checks failed
/ release (push) Waiting to run
testing / backend-checks (push) Has been skipped
testing / frontend-checks (push) Has been skipped
testing / test-unit (push) Has been skipped
testing / test-e2e (push) Has been skipped
testing / test-mysql (push) Has been skipped
testing / test-pgsql (push) Has been skipped
testing / test-sqlite (push) Has been skipped
testing / test-remote-cacher (redis) (push) Has been skipped
testing / test-remote-cacher (valkey) (push) Has been skipped
testing / test-remote-cacher (garnet) (push) Has been skipped
testing / test-remote-cacher (redict) (push) Has been skipped
testing / security-check (push) Has been skipped
Integration tests for the release process / release-simulation (push) Has been cancelled
- The 'Failed to load asset files from [...]' is now an translatable string. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7388 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: 0ko <0ko@noreply.codeberg.org> Co-committed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
parent
c497ef9e81
commit
6ad625b0c1
4 changed files with 45 additions and 18 deletions
41
tests/integration/common_navigation_test.go
Normal file
41
tests/integration/common_navigation_test.go
Normal file
|
@ -0,0 +1,41 @@
|
|||
// Copyright 2024-2025 The Forgejo Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"forgejo.org/models/unittest"
|
||||
"forgejo.org/modules/translation"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// This test verifies common elements that are visible on all pages but most
|
||||
// likely to be first seen on `/`
|
||||
func TestCommonNavigationElements(t *testing.T) {
|
||||
require.NoError(t, unittest.PrepareTestDatabase())
|
||||
|
||||
session := loginUser(t, "user1")
|
||||
locale := translation.NewLocale("en-US")
|
||||
|
||||
response := session.MakeRequest(t, NewRequest(t, "GET", "/"), http.StatusOK)
|
||||
page := NewHTMLParser(t, response.Body)
|
||||
|
||||
// Navbar
|
||||
links := page.Find("#navbar .dropdown[data-tooltip-content='Create…'] .menu")
|
||||
assert.Equal(t, locale.TrString("new_repo.link"), strings.TrimSpace(links.Find("a[href='/repo/create']").Text()))
|
||||
assert.Equal(t, locale.TrString("new_migrate.link"), strings.TrimSpace(links.Find("a[href='/repo/migrate']").Text()))
|
||||
assert.Equal(t, locale.TrString("new_org.link"), strings.TrimSpace(links.Find("a[href='/org/create']").Text()))
|
||||
|
||||
// After footer: index.js
|
||||
page.AssertElement(t, "script[src^='/assets/js/index.js']", true)
|
||||
onerror, _ := page.Find("script[src^='/assets/js/index.js']").Attr("onerror")
|
||||
expected := fmt.Sprintf("alert('%s'.replace('{path}', this.src))", locale.TrString("alert.asset_load_failed"))
|
||||
assert.Equal(t, expected, onerror)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue