Skip to content

Commit a8dc96b

Browse files
committed
fix: reorder the height and width in WindowTooSmallModel
1 parent cf7566f commit a8dc96b

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

tui/windowSizeTooSmallDialog.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,12 @@ func (m WindowTooSmallModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
2525
}
2626

2727
func (m WindowTooSmallModel) View() string {
28-
return windowTooSmallStyle.Render(fmt.Sprintf("Window size too small (%d x %d)\n\nConsider going fullscreen for optimal experience.", m.height, m.width))
28+
return windowTooSmallStyle.Render(fmt.Sprintf(
29+
"Window size too small (%d x %d)\n\n"+
30+
"Min Width: 65, Min Height: 25 are the minimum requirements.\n\n"+
31+
"Consider going fullscreen for optimal experience.",
32+
m.width, m.height,
33+
))
2934
}
3035

3136
func MakeNewWindowTooSmallModel() WindowTooSmallModel {
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package tui
2+
3+
import (
4+
"testing"
5+
6+
tea "github.com/charmbracelet/bubbletea"
7+
)
8+
9+
func TestWindowTooSmallModel_Update(t *testing.T) {
10+
model := WindowTooSmallModel{}
11+
12+
msg := tea.WindowSizeMsg{Width: 100, Height: 24}
13+
updatedModel, _ := model.Update(msg)
14+
15+
if updatedModel.(WindowTooSmallModel).width != 100 {
16+
t.Errorf("expected width to be 100, got %d", updatedModel.(WindowTooSmallModel).width)
17+
}
18+
if updatedModel.(WindowTooSmallModel).height != 24 {
19+
t.Errorf("expected height to be 24, got %d", updatedModel.(WindowTooSmallModel).height)
20+
}
21+
}
22+
23+
func TestWindowTooSmallModel_View(t *testing.T) {
24+
model := WindowTooSmallModel{width: 100, height: 24}
25+
expectedOutput := windowTooSmallStyle.Render("Window size too small (100 x 24)\n\nConsider going fullscreen for optimal experience.")
26+
27+
if model.View() != expectedOutput {
28+
t.Errorf("expected %q, got %q", expectedOutput, model.View())
29+
}
30+
}

0 commit comments

Comments
 (0)