main 5041353

popup_test.go RawHistoryFolder

1package content
2
3import (
4	"testing"
5
6	"github.com/stretchr/testify/assert"
7
8	"github.com/bnema/dumber/internal/domain/entity"
9)
10
11// ---------------------------------------------------------------------------
12// DetectPopupType
13// ---------------------------------------------------------------------------
14
15func TestDetectPopupType_BlankIsTab(t *testing.T) {
16	t.Parallel()
17
18	assert.Equal(t, PopupTypeTab, DetectPopupType("_blank"))
19}
20
21func TestDetectPopupType_EmptyIsPopup(t *testing.T) {
22	t.Parallel()
23
24	assert.Equal(t, PopupTypePopup, DetectPopupType(""))
25}
26
27func TestDetectPopupType_NamedFrameIsPopup(t *testing.T) {
28	t.Parallel()
29
30	assert.Equal(t, PopupTypePopup, DetectPopupType("myFrame"))
31}
32
33// ---------------------------------------------------------------------------
34// PopupType.String()
35// ---------------------------------------------------------------------------
36
37func TestPopupTypeString_Tab(t *testing.T) {
38	t.Parallel()
39
40	assert.Equal(t, "tab", PopupTypeTab.String())
41}
42
43func TestPopupTypeString_Popup(t *testing.T) {
44	t.Parallel()
45
46	assert.Equal(t, "popup", PopupTypePopup.String())
47}
48
49func TestPopupTypeString_Unknown(t *testing.T) {
50	t.Parallel()
51
52	assert.Equal(t, "unknown", PopupType(99).String())
53}
54
55// ---------------------------------------------------------------------------
56// GetBehavior
57// ---------------------------------------------------------------------------
58
59func TestGetBehavior_NilConfigReturnsSplit(t *testing.T) {
60	t.Parallel()
61
62	assert.Equal(t, entity.PopupBehaviorSplit, GetBehavior(PopupTypeTab, nil))
63	assert.Equal(t, entity.PopupBehaviorSplit, GetBehavior(PopupTypePopup, nil))
64}
65
66func TestGetBehavior_TabPopup_DefaultConfig(t *testing.T) {
67	t.Parallel()
68
69	// BlankTargetBehavior is empty → falls through to default "stacked"
70	cfg := &entity.BrowsingContextConfig{}
71	assert.Equal(t, entity.PopupBehaviorStacked, GetBehavior(PopupTypeTab, cfg))
72}
73
74func TestGetBehavior_TabPopup_SplitConfig(t *testing.T) {
75	t.Parallel()
76
77	cfg := &entity.BrowsingContextConfig{BlankTargetBehavior: "split"}
78	assert.Equal(t, entity.PopupBehaviorSplit, GetBehavior(PopupTypeTab, cfg))
79}
80
81func TestGetBehavior_TabPopup_StackedConfig(t *testing.T) {
82	t.Parallel()
83
84	cfg := &entity.BrowsingContextConfig{BlankTargetBehavior: "stacked"}
85	assert.Equal(t, entity.PopupBehaviorStacked, GetBehavior(PopupTypeTab, cfg))
86}
87
88func TestGetBehavior_TabPopup_TabbedConfig(t *testing.T) {
89	t.Parallel()
90
91	cfg := &entity.BrowsingContextConfig{BlankTargetBehavior: "tabbed"}
92	assert.Equal(t, entity.PopupBehaviorTabbed, GetBehavior(PopupTypeTab, cfg))
93}
94
95func TestGetBehavior_JSPopup_UsesBehaviorField(t *testing.T) {
96	t.Parallel()
97
98	cfg := &entity.BrowsingContextConfig{Behavior: entity.PopupBehaviorWindowed}
99	assert.Equal(t, entity.PopupBehaviorWindowed, GetBehavior(PopupTypePopup, cfg))
100}
101
102func TestGetBehavior_JSPopup_DefaultConfig(t *testing.T) {
103	t.Parallel()
104
105	// Behavior zero-value is empty string; GetBehavior returns it as-is.
106	cfg := &entity.BrowsingContextConfig{}
107	assert.Equal(t, entity.PopupBehavior(""), GetBehavior(PopupTypePopup, cfg))
108}
109
110func TestGetBehavior_TabPopup_BlocksWhenOpenInNewPaneFalse(t *testing.T) {
111	t.Parallel()
112
113	// GetBehavior itself does not honor OpenInNewPane — that is enforced by
114	// handlePopupCreate. GetBehavior still returns the configured value.
115	cfg := &entity.BrowsingContextConfig{
116		OpenInNewPane:       false,
117		BlankTargetBehavior: "split",
118	}
119	assert.Equal(t, entity.PopupBehaviorSplit, GetBehavior(PopupTypeTab, cfg))
120}

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