Skip to content

Commit bc4d8b5

Browse files
committed
add tests and fix styling
1 parent 2a8d0c8 commit bc4d8b5

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

templates/explore/repo_search.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<div class="ui dropdown type jump item gt-mx-0">
2020
<span class="text">{{.locale.Tr "repo.repo_lang"}}</span>
2121
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
22-
<div class="menu">
22+
<div class="menu short">
2323
<div class="ui icon search input">
2424
<i class="icon">{{svg "octicon-search" 16}}</i>
2525
<input type="text" placeholder="{{.locale.Tr "repo.repo_lang"}}">

tests/integration/api_languages_test.go

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,41 @@ import (
77
"net/http"
88
"testing"
99

10+
api "code.gitea.io/gitea/modules/structs"
1011
"code.gitea.io/gitea/tests"
12+
13+
"github.com/stretchr/testify/assert"
1114
)
1215

16+
func testLanguageList(t *testing.T, uri string) {
17+
req := NewRequest(t, "GET", uri)
18+
resp := MakeRequest(t, req, http.StatusOK)
19+
20+
var langs []api.LanguageInfo
21+
DecodeJSON(t, resp, &langs)
22+
23+
for _, lang := range langs {
24+
assert.NotEqual(t, lang.Name, "")
25+
assert.NotEqual(t, lang.Color, "")
26+
}
27+
}
28+
1329
func TestAPIListLanguages(t *testing.T) {
1430
defer tests.PrepareTestEnv(t)()
1531

16-
req := NewRequest(t, "GET", "/api/v1/repos/languages")
17-
resp := MakeRequest(t, req, http.StatusOK)
32+
testLanguageList(t, "/api/v1/repos/languages")
33+
}
1834

19-
var langs map[string]string
20-
DecodeJSON(t, resp, &langs)
35+
func TestAPIListUserLanguages(t *testing.T) {
36+
defer tests.PrepareTestEnv(t)()
37+
38+
loginUser(t, "user2")
39+
testLanguageList(t, "/api/v1/users/user2/languages")
2140
}
41+
42+
func TestAPIListOrgLanguages(t *testing.T) {
43+
defer tests.PrepareTestEnv(t)()
44+
45+
loginUser(t, "user2")
46+
testLanguageList(t, "/api/v1/orgs/user3/languages")
47+
}

web_src/fomantic/build/semantic.css

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)