Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Code

392 commit(s) on main

Merge change request 01M70WES5ZZDJ6RP226WB11BBZ: Let people rename and remove their own passkeys keenan · 2h ago 4b8c9e1d
history blame raw 1.8 KiB
1package server_test
2
3// The global bar: which destinations it offers, and which one it says you are on.
4
5import (
6 "net/http"
7 "strings"
8 "testing"
9)
10
11// TestHomeIsTheGlobalDestination: the bar needs a text destination for the
12// landing page. The emblem links there too, but a mark is not a label. Home is
13// current only on the landing page: a repository page has its own tabs saying
14// where the reader is, so the global bar must not claim they are on Home.
15func TestHomeIsTheGlobalDestination(t *testing.T) {
16 t.Parallel()
17 f := newFixture(t)
18 f.publish(f.repo)
19
20 code, body := f.get("/")
21 if code != http.StatusOK {
22 t.Fatalf("/ = %d", code)
23 }
24 if !strings.Contains(body, ">Home</a>") {
25 t.Fatalf("/ has no Home link:\n%s", body)
26 }
27 if !strings.Contains(body, `class="active" href="/" aria-current="page"`) {
28 t.Fatalf("/ does not mark Home current:\n%s", body)
29 }
30 if !strings.Contains(body, `class="icon"`) {
31 t.Fatalf("/ renders the Home link without an icon")
32 }
33
34 // A repository page is not the landing page. Its own header tabs carry the
35 // context, so Home must not take that role from them.
36 code, body = f.get("/" + f.repo)
37 if code != http.StatusOK {
38 t.Fatalf("/%s = %d", f.repo, code)
39 }
40 if strings.Contains(body, `class="active" href="/"`) {
41 t.Fatalf("repository page marks Home current:\n%s", body)
42 }
43
44 // Activity is a different destination, so it takes over, which is what makes
45 // the bar say where you are.
46 code, body = f.get("/-/activity")
47 if code != http.StatusOK {
48 t.Fatalf("/-/activity = %d", code)
49 }
50 if strings.Contains(body, `class="active" href="/"`) {
51 t.Fatalf("/-/activity marks Home current:\n%s", body)
52 }
53 if !strings.Contains(body, `class="active" href="/-/activity"`) {
54 t.Fatalf("/-/activity does not mark Activity current:\n%s", body)
55 }
56}
57