detached 5041353

pool_context_menu_test.go RawHistoryFolder

1package webkit
2
3import (
4	"context"
5	"testing"
6
7	"github.com/bnema/dumber/internal/domain/entity"
8	"github.com/bnema/puregotk/v4/webkit"
9)
10
11func TestNeedsExplicitContextMenuSignalOnAcquire(t *testing.T) {
12	t.Run("true for prewarmed view that already has other signals", func(t *testing.T) {
13		wv := &WebView{signalIDs: []uintptr{1, 2, 3}}
14		if !needsExplicitContextMenuSignalOnAcquire(wv, &contextMenuPipeline{}) {
15			t.Fatal("expected prewarmed webview to require explicit context-menu signal connection")
16		}
17	})
18
19	t.Run("false when pipeline missing", func(t *testing.T) {
20		wv := &WebView{signalIDs: []uintptr{1}}
21		if needsExplicitContextMenuSignalOnAcquire(wv, nil) {
22			t.Fatal("expected missing pipeline to skip explicit context-menu signal connection")
23		}
24	})
25
26	t.Run("false for reused view with disconnected signals", func(t *testing.T) {
27		wv := &WebView{}
28		if needsExplicitContextMenuSignalOnAcquire(wv, &contextMenuPipeline{}) {
29			t.Fatal("expected reused webview to rely on full signal reconnection")
30		}
31	})
32}
33
34func TestShouldReapplySettingsOnAcquire(t *testing.T) {
35	settings := NewSettingsManager(context.Background(), entity.EngineSettingsPayload{})
36
37	tests := []struct {
38		name     string
39		settings *SettingsManager
40		wv       *WebView
41		want     bool
42	}{
43		{
44			name:     "true for current settings and native webview",
45			settings: settings,
46			wv:       &WebView{inner: &webkit.WebView{}},
47			want:     true,
48		},
49		{
50			name:     "false without settings manager",
51			settings: nil,
52			wv:       &WebView{inner: &webkit.WebView{}},
53		},
54		{
55			name:     "false without pooled webview",
56			settings: settings,
57			wv:       nil,
58		},
59		{
60			name:     "false before native webview exists",
61			settings: settings,
62			wv:       &WebView{},
63		},
64	}
65
66	for _, tt := range tests {
67		t.Run(tt.name, func(t *testing.T) {
68			if got := shouldReapplySettingsOnAcquire(tt.settings, tt.wv); got != tt.want {
69				t.Fatalf("shouldReapplySettingsOnAcquire() = %v, want %v", got, tt.want)
70			}
71		})
72	}
73}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close