internal/httpd/searchweb_test.go

4a511e42574ead9c92dc73fd320f296cc4dbea07
gitbay/internal/httpd/searchweb_test.go

28 lines · 782 bytes

1 symbol in this file
 1package httpd
 2
 3import (
 4	"strings"
 5	"testing"
 6
 7	"gitbay.org/gitbay/internal/web"
 8)
 9
10// The scope sentence is a permanent caption, not a first-visit-only
11// hint: a visitor who has already searched still needs to know what a
12// search here does and does not cover (#270).
13func TestGlobalSearchScopeCaptionAlwaysShown(t *testing.T) {
14	var sb strings.Builder
15	if err := web.Render(&sb, "globalsearch.html", struct {
16		basePage
17		Tab      string
18		Query    string
19		Kind     string
20		QueryErr string
21		Results  []searchResult
22	}{basePage{Site: "gitbay"}, "sitesearch", "gitbay", "", "", nil}); err != nil {
23		t.Fatalf("render: %v", err)
24	}
25	if !strings.Contains(sb.String(), "File contents are searched per repository") {
26		t.Error("scope caption missing once a query is present")
27	}
28}
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form