Release Please / Release Please (push) Skipped
Tests / Test (Go 1.22) (push) Skipped
Tests / Test (Go stable) (push) Skipped
Release / GoReleaser (push) Failing after 38s
Polish the office TUI with proportional pane layout, drag resize, live filtering, HTML mail preview, paginated mail lists, overflow scrollbars, flattened navigation, and project save/status fixes; add UpdateProjectStatus. Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
package ui
|
|
|
|
import "testing"
|
|
|
|
func TestDividerAtBetweenMenuAndList(t *testing.T) {
|
|
pw := PaneWidths{
|
|
Menu: 30, List: 50, Detail: 40,
|
|
Visibility: PaneVisibility{Menu: true, List: true, Detail: true},
|
|
}
|
|
if got := DividerAt(30, pw); got != 0 {
|
|
t.Fatalf("divider at 30=%d want 0", got)
|
|
}
|
|
if got := DividerAt(80, pw); got != 1 {
|
|
t.Fatalf("divider at 80=%d want 1", got)
|
|
}
|
|
}
|
|
|
|
func TestDragPaneDividerRespectsMinimum(t *testing.T) {
|
|
pw := PaneWidths{
|
|
Menu: 40, List: 40, Detail: 40,
|
|
Visibility: PaneVisibility{Menu: true, List: true, Detail: true},
|
|
}
|
|
next, ok := DragPaneDivider(pw, 0, -30)
|
|
if ok {
|
|
t.Fatalf("expected resize blocked by minimum, got %+v", next)
|
|
}
|
|
next, ok = DragPaneDivider(pw, 0, 5)
|
|
if !ok || next.Menu != 45 || next.List != 35 {
|
|
t.Fatalf("resize failed: ok=%v %+v", ok, next)
|
|
}
|
|
}
|
|
|
|
func TestFitPaneWidthsScalesToTotal(t *testing.T) {
|
|
vis := PaneVisibility{Menu: true, List: true, Detail: true}
|
|
sizes := PaneWidths{Menu: 20, List: 30, Detail: 50, Visibility: vis}
|
|
out := FitPaneWidths(120, vis, sizes)
|
|
sum := out.Menu + out.List + out.Detail
|
|
if sum != 120 {
|
|
t.Fatalf("sum=%d want 120", sum)
|
|
}
|
|
}
|