mirror of
https://github.com/lukaszraczylo/lolcathost.git
synced 2026-10-11 04:47:18 +00:00
Switch imports to the charm.land v2 modules. Return tea.View from Model.View, set alt screen and window title there, use KeyPressMsg and the "space" key name, and call SetWidth on text inputs.
26 lines
548 B
Go
26 lines
548 B
Go
package tui
|
|
|
|
import (
|
|
"testing"
|
|
|
|
tea "charm.land/bubbletea/v2"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestModel_View_UsesAltScreenAndTitle(t *testing.T) {
|
|
m := NewModel("/nonexistent.sock")
|
|
|
|
v := m.View()
|
|
|
|
assert.True(t, v.AltScreen)
|
|
assert.Equal(t, "lolcathost", v.WindowTitle)
|
|
assert.Contains(t, v.Content, "lolcathost - Host Management")
|
|
}
|
|
|
|
func TestModel_SpaceKeyIsNamedSpace(t *testing.T) {
|
|
msg := tea.KeyPressMsg{Code: tea.KeySpace, Text: " "}
|
|
|
|
require.Equal(t, "space", msg.String())
|
|
}
|