Implement TUI pane navigation

This commit is contained in:
Philip Henning 2025-08-13 15:57:35 +02:00
parent 3561d15858
commit a24041d664
6 changed files with 137 additions and 73 deletions

View file

@ -45,3 +45,20 @@ func TestViewModeStatusBar(t *testing.T) {
assert.Contains(t, view, "[✓] localhost")
assert.Contains(t, view, "[ ] example.com")
}
func TestPaneSwitching(t *testing.T) {
sample := "127.0.0.1 localhost\n192.168.1.10 example.com"
lines := strings.Split(sample, "\n")
hf, _, err := core.ParseHostsContent(lines)
require.NoError(t, err)
m := tui.NewModel(hf)
// Switch focus to detail pane
nm, _ := m.Update(tea.KeyMsg{Type: tea.KeyTab})
m = nm.(tui.Model)
// Attempt to move down; selection should remain on first entry
nm, _ = m.Update(tea.KeyMsg{Type: tea.KeyDown})
m = nm.(tui.Model)
assert.Equal(t, "localhost", m.SelectedEntry().Hostname)
}