mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-03-25 19:33:03 -04:00
Some checks are pending
Integration tests for the release process / release-simulation (push) Waiting to run
/ release (push) Waiting to run
testing-integration / test-unit (push) Waiting to run
testing-integration / test-sqlite (push) Waiting to run
testing-integration / test-mariadb (v10.6) (push) Waiting to run
testing-integration / test-mariadb (v11.8) (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
This PR replaces the sort dropdowns on Users and Organizations pages of Explore with the one we've got earlier in two other areas. Previous such replacement happened in #8572. This implies a few positive changes such as: * larger font size * larger clickable area for coarse cursor * it is possible to use while scripts are still loading * it is possible to use w/o JS Some refactors were made to support this change and as general improvements. Desktop, closed B: https://codeberg.org/attachments/354f7194-b247-4ecd-8875-2e95dadc7445 A: https://codeberg.org/attachments/0fa49cf5-e8e5-4c15-b2b0-7d13e8505945 Desktop, open B: https://codeberg.org/attachments/b01b75d1-dbe4-458c-abd5-64cd8c121bc1 A: https://codeberg.org/attachments/94baccc4-fe36-4ae1-ace0-9b4d5fbd9f42 Mobile, open B: https://codeberg.org/attachments/f868720a-ec71-4829-87f7-a1cfab860e37 A: https://codeberg.org/attachments/bbe72710-6824-4107-8086-d2bd50897038 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/9556 Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
50 lines
1.5 KiB
Go
50 lines
1.5 KiB
Go
// Copyright 2024 The Gitea Authors. All rights reserved.
|
|
// Copyright 2025 The Forgejo Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package integration
|
|
|
|
import (
|
|
"net/http"
|
|
"testing"
|
|
|
|
"forgejo.org/modules/setting"
|
|
"forgejo.org/modules/test"
|
|
"forgejo.org/tests"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestExploreUser(t *testing.T) {
|
|
defer tests.PrepareTestEnv(t)()
|
|
|
|
// Set the default sort order
|
|
defer test.MockVariableValue(&setting.UI.ExploreDefaultSort, "reversealphabetically")()
|
|
|
|
cases := []struct{ sortOrder, expected string }{
|
|
{"", "?sort=" + setting.UI.ExploreDefaultSort + "&q="},
|
|
{"newest", "?sort=newest&q="},
|
|
{"oldest", "?sort=oldest&q="},
|
|
{"alphabetically", "?sort=alphabetically&q="},
|
|
{"reversealphabetically", "?sort=reversealphabetically&q="},
|
|
}
|
|
for _, c := range cases {
|
|
req := NewRequest(t, "GET", "/explore/users?sort="+c.sortOrder)
|
|
resp := MakeRequest(t, req, http.StatusOK)
|
|
h := NewHTMLParser(t, resp.Body)
|
|
href, _ := h.Find(`.list-header details.dropdown > ul > li > a.active[href^="?sort="]`).Attr("href")
|
|
assert.Equal(t, c.expected, href)
|
|
}
|
|
|
|
// these sort orders shouldn't be supported, to avoid leaking user activity
|
|
cases404 := []string{
|
|
"/explore/users?sort=lastlogin",
|
|
"/explore/users?sort=reverselastlogin",
|
|
"/explore/users?sort=leastupdate",
|
|
"/explore/users?sort=reverseleastupdate",
|
|
}
|
|
for _, c := range cases404 {
|
|
req := NewRequest(t, "GET", c).SetHeader("Accept", "text/html")
|
|
MakeRequest(t, req, http.StatusNotFound)
|
|
}
|
|
}
|