summaryrefslogtreecommitdiffhomepage
path: root/packages/tui/internal/layout
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-07-04 10:29:40 -0500
committeradamdottv <[email protected]>2025-07-04 10:55:02 -0500
commitf9abc7c84f2544f5844d795bf835064114734817 (patch)
tree9719b89b2477e53021aad5fe94c5d465d3f5362b /packages/tui/internal/layout
parent891ed6ebc006703d5a26f89ecc85bd86f9b2133e (diff)
downloadopencode-f9abc7c84f2544f5844d795bf835064114734817.tar.gz
opencode-f9abc7c84f2544f5844d795bf835064114734817.zip
feat(tui): file attachments
Diffstat (limited to 'packages/tui/internal/layout')
-rw-r--r--packages/tui/internal/layout/flex_example_test.go41
-rw-r--r--packages/tui/internal/layout/flex_test.go90
2 files changed, 0 insertions, 131 deletions
diff --git a/packages/tui/internal/layout/flex_example_test.go b/packages/tui/internal/layout/flex_example_test.go
deleted file mode 100644
index a03346eb7..000000000
--- a/packages/tui/internal/layout/flex_example_test.go
+++ /dev/null
@@ -1,41 +0,0 @@
-package layout_test
-
-import (
- "fmt"
- "github.com/sst/opencode/internal/layout"
-)
-
-func ExampleRender_withGap() {
- // Create a horizontal layout with 3px gap between items
- result := layout.Render(
- layout.FlexOptions{
- Direction: layout.Row,
- Width: 30,
- Height: 1,
- Gap: 3,
- },
- layout.FlexItem{View: "Item1"},
- layout.FlexItem{View: "Item2"},
- layout.FlexItem{View: "Item3"},
- )
- fmt.Println(result)
- // Output: Item1 Item2 Item3
-}
-
-func ExampleRender_withGapAndJustify() {
- // Create a horizontal layout with gap and space-between justification
- result := layout.Render(
- layout.FlexOptions{
- Direction: layout.Row,
- Width: 30,
- Height: 1,
- Gap: 2,
- Justify: layout.JustifySpaceBetween,
- },
- layout.FlexItem{View: "A"},
- layout.FlexItem{View: "B"},
- layout.FlexItem{View: "C"},
- )
- fmt.Println(result)
- // Output: A B C
-}
diff --git a/packages/tui/internal/layout/flex_test.go b/packages/tui/internal/layout/flex_test.go
deleted file mode 100644
index cad38dc8f..000000000
--- a/packages/tui/internal/layout/flex_test.go
+++ /dev/null
@@ -1,90 +0,0 @@
-package layout
-
-import (
- "strings"
- "testing"
-)
-
-func TestFlexGap(t *testing.T) {
- tests := []struct {
- name string
- opts FlexOptions
- items []FlexItem
- expected string
- }{
- {
- name: "Row with gap",
- opts: FlexOptions{
- Direction: Row,
- Width: 20,
- Height: 1,
- Gap: 2,
- },
- items: []FlexItem{
- {View: "A"},
- {View: "B"},
- {View: "C"},
- },
- expected: "A B C",
- },
- {
- name: "Column with gap",
- opts: FlexOptions{
- Direction: Column,
- Width: 1,
- Height: 5,
- Gap: 1,
- Align: AlignStart,
- },
- items: []FlexItem{
- {View: "A", FixedSize: 1},
- {View: "B", FixedSize: 1},
- {View: "C", FixedSize: 1},
- },
- expected: "A\n \nB\n \nC",
- },
- {
- name: "Row with gap and justify space between",
- opts: FlexOptions{
- Direction: Row,
- Width: 15,
- Height: 1,
- Gap: 1,
- Justify: JustifySpaceBetween,
- },
- items: []FlexItem{
- {View: "A"},
- {View: "B"},
- {View: "C"},
- },
- expected: "A B C",
- },
- {
- name: "No gap specified",
- opts: FlexOptions{
- Direction: Row,
- Width: 10,
- Height: 1,
- },
- items: []FlexItem{
- {View: "A"},
- {View: "B"},
- {View: "C"},
- },
- expected: "ABC",
- },
- }
-
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- result := Render(tt.opts, tt.items...)
- // Trim any trailing spaces for comparison
- result = strings.TrimRight(result, " ")
- expected := strings.TrimRight(tt.expected, " ")
-
- if result != expected {
- t.Errorf("Render() = %q, want %q", result, expected)
- }
- })
- }
-}