c42a19f7d3
Make OpenCode authoring responsive and expand the managed skill references. Add conflict-aware import/export, real-provider reference workflows, and tracked V2 generation for reliable budget accounting.
42 lines
1.2 KiB
Go
42 lines
1.2 KiB
Go
package tui
|
|
|
|
import (
|
|
"git.a-wan.net/alan/pipelines/internal/protocol"
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
"github.com/charmbracelet/x/ansi"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestMultiPickerSelectionsSurviveFiltering(t *testing.T) {
|
|
p := multiPicker{picker: picker{items: []protocol.PipelineSummary{{ID: 1, Name: "alpha"}, {ID: 2, Name: "beta"}}, input: newInput(), width: 80, height: 20}, checked: map[int64]bool{}, title: "Select pipelines to export"}
|
|
key := func(k tea.KeyMsg) { t.Helper(); m, _ := p.Update(k); p = m.(multiPicker) }
|
|
key(tea.KeyMsg{Type: tea.KeyEnter})
|
|
if p.accepted {
|
|
t.Fatal("empty selection accepted")
|
|
}
|
|
key(tea.KeyMsg{Type: tea.KeySpace})
|
|
if !p.checked[1] {
|
|
t.Fatal("space did not check")
|
|
}
|
|
p.input.SetValue("beta")
|
|
key(tea.KeyMsg{Type: tea.KeyCtrlA})
|
|
if !p.checked[1] || !p.checked[2] {
|
|
t.Fatal("filtered select lost hidden item")
|
|
}
|
|
key(tea.KeyMsg{Type: tea.KeyCtrlA})
|
|
if !p.checked[1] || p.checked[2] {
|
|
t.Fatal("filtered deselect lost hidden item")
|
|
}
|
|
key(tea.KeyMsg{Type: tea.KeyEnter})
|
|
if !p.accepted {
|
|
t.Fatal("selection not accepted")
|
|
}
|
|
p.width = 25
|
|
for _, line := range strings.Split(p.View(), "\n") {
|
|
if ansi.StringWidth(line) > 23 {
|
|
t.Fatal("picker overflows", line)
|
|
}
|
|
}
|
|
}
|