feat(office): add Workspace TUI with shared bootstrap and test suite
Introduce the office Bubble Tea browser (module tree, multi-select lists, markdown preview) alongside oo, with cmd/internal/bootstrap for shared auth, unit tests across preview/model/ui/fetch, CI build for both binaries, and GoReleaser archives for office. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package ui_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/eslider/go-onlyoffice/cmd/office/model"
|
||||
"github.com/eslider/go-onlyoffice/cmd/office/ui"
|
||||
)
|
||||
|
||||
func TestKeyActionMenuDown(t *testing.T) {
|
||||
if got := ui.KeyAction("j", model.FocusMenu); got != ui.ActionMoveDown {
|
||||
t.Fatalf("got %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestKeyActionListToggleSelect(t *testing.T) {
|
||||
if got := ui.KeyAction(" ", model.FocusList); got != ui.ActionToggleSelect {
|
||||
t.Fatalf("got %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestKeyActionPreviewNoOp(t *testing.T) {
|
||||
if got := ui.KeyAction(" ", model.FocusPreview); got != ui.ActionNone {
|
||||
t.Fatalf("got %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestKeyActionTabNextPane(t *testing.T) {
|
||||
if got := ui.KeyAction("tab", model.FocusList); got != ui.ActionNextPane {
|
||||
t.Fatalf("got %v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLayoutWidths(t *testing.T) {
|
||||
menu, list, preview := ui.LayoutWidths(120)
|
||||
if menu+list+preview > 120 {
|
||||
t.Fatalf("widths exceed total: %d+%d+%d", menu, list, preview)
|
||||
}
|
||||
if menu < 20 || list < 30 || preview < 30 {
|
||||
t.Fatalf("widths too narrow: %d %d %d", menu, list, preview)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user