main 5041353

theme_test.go RawHistoryFolder

1package styles_test
2
3import (
4	"testing"
5
6	"github.com/charmbracelet/lipgloss"
7	"github.com/stretchr/testify/require"
8
9	"github.com/bnema/dumber/internal/cli/styles"
10	"github.com/bnema/dumber/internal/domain/entity"
11)
12
13func TestNewThemeFromResolvedUsesActivePalette(t *testing.T) {
14	resolved := entity.ResolvedTheme{
15		ActivePalette: entity.ColorPalette{
16			Background:     "#010101",
17			Surface:        "#020202",
18			SurfaceVariant: "#030303",
19			Text:           "#fefefe",
20			Muted:          "#999999",
21			Accent:         "#abcdef",
22			Border:         "#444444",
23		},
24	}
25
26	theme := styles.NewThemeFromResolved(resolved)
27
28	require.Equal(t, lipgloss.Color("#010101"), theme.Background)
29	require.Equal(t, lipgloss.Color("#abcdef"), theme.Accent)
30	require.Equal(t, lipgloss.Color("#abcdef"), theme.Success)
31}
32
33func TestNewThemeFromResolvedFallsBackToDarkPalette(t *testing.T) {
34	resolved := entity.ResolvedTheme{
35		DarkPalette: entity.ColorPalette{
36			Background:     "#111111",
37			Surface:        "#222222",
38			SurfaceVariant: "#333333",
39			Text:           "#eeeeee",
40			Muted:          "#888888",
41			Accent:         "#fedcba",
42			Border:         "#444444",
43		},
44	}
45
46	theme := styles.NewThemeFromResolved(resolved)
47
48	require.Equal(t, lipgloss.Color("#111111"), theme.Background)
49	require.Equal(t, lipgloss.Color("#fedcba"), theme.Accent)
50}
51
52func TestNewThemeFromResolvedFallsBackToDefaultDarkPalette(t *testing.T) {
53	resolved := entity.ResolvedTheme{}
54	palette := styles.DefaultDarkPalette()
55
56	theme := styles.NewThemeFromResolved(resolved)
57
58	require.Equal(t, lipgloss.Color(palette.Background), theme.Background)
59	require.Equal(t, lipgloss.Color(palette.Surface), theme.Surface)
60	require.Equal(t, lipgloss.Color(palette.Text), theme.Text)
61	require.Equal(t, lipgloss.Color(palette.Accent), theme.Accent)
62	require.Equal(t, lipgloss.Color(palette.Accent), theme.Success)
63}

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