summaryrefslogtreecommitdiff
path: root/internal/hexaiaction/tui_delegate_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/hexaiaction/tui_delegate_test.go')
-rw-r--r--internal/hexaiaction/tui_delegate_test.go42
1 files changed, 21 insertions, 21 deletions
diff --git a/internal/hexaiaction/tui_delegate_test.go b/internal/hexaiaction/tui_delegate_test.go
index 27881e4..4bdb359 100644
--- a/internal/hexaiaction/tui_delegate_test.go
+++ b/internal/hexaiaction/tui_delegate_test.go
@@ -1,32 +1,32 @@
package hexaiaction
import (
- "bytes"
- "regexp"
- "testing"
+ "bytes"
+ "regexp"
+ "testing"
- "github.com/charmbracelet/bubbles/list"
+ "github.com/charmbracelet/bubbles/list"
)
func stripANSI(s string) string {
- re := regexp.MustCompile(`\x1b\[[0-9;]*m`)
- return re.ReplaceAllString(s, "")
+ re := regexp.MustCompile(`\x1b\[[0-9;]*m`)
+ return re.ReplaceAllString(s, "")
}
func TestOneLineDelegate_Render(t *testing.T) {
- items := []list.Item{item{title: "Rewrite selection", kind: ActionRewrite, hotkey: 'r'}}
- m := list.New(items, oneLineDelegate{}, 0, 0)
- m.Select(0)
- var b bytes.Buffer
- oneLineDelegate{}.Render(&b, m, 0, items[0])
- out := stripANSI(b.String())
- if !regexp.MustCompile(`> \w`).MatchString(out) {
- t.Fatalf("expected cursor prefix in %q", out)
- }
- if !regexp.MustCompile(`Rewrite selection`).MatchString(out) {
- t.Fatalf("expected title in %q", out)
- }
- if !regexp.MustCompile(`\(r\)`).MatchString(out) {
- t.Fatalf("expected hotkey in %q", out)
- }
+ items := []list.Item{item{title: "Rewrite selection", kind: ActionRewrite, hotkey: 'r'}}
+ m := list.New(items, oneLineDelegate{}, 0, 0)
+ m.Select(0)
+ var b bytes.Buffer
+ oneLineDelegate{}.Render(&b, m, 0, items[0])
+ out := stripANSI(b.String())
+ if !regexp.MustCompile(`> \w`).MatchString(out) {
+ t.Fatalf("expected cursor prefix in %q", out)
+ }
+ if !regexp.MustCompile(`Rewrite selection`).MatchString(out) {
+ t.Fatalf("expected title in %q", out)
+ }
+ if !regexp.MustCompile(`\(r\)`).MatchString(out) {
+ t.Fatalf("expected hotkey in %q", out)
+ }
}