MCPcopy
hub / github.com/moncho/dry / TestModel_LessScrolling

Function TestModel_LessScrolling

app/model_test.go:1131–1163  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1129}
1130
1131func TestModel_LessScrolling(t *testing.T) {
1132 m := newTestModel()
1133
1134 // Create a showLessMsg with many lines
1135 lines := make([]string, 100)
1136 for i := range 100 {
1137 lines[i] = fmt.Sprintf("Line %d: content", i+1)
1138 }
1139 content := strings.Join(lines, "\n")
1140
1141 result, _ := m.Update(showLessMsg{content: content, title: "Test"})
1142 m = result.(model)
1143
1144 if m.overlay != overlayLess {
1145 t.Fatalf("expected overlayLess, got %d", m.overlay)
1146 }
1147
1148 v1 := m.View()
1149
1150 // Scroll down with 'j'
1151 result, _ = m.Update(tea.KeyPressMsg{Code: 'j'})
1152 m = result.(model)
1153 result, _ = m.Update(tea.KeyPressMsg{Code: 'j'})
1154 m = result.(model)
1155 result, _ = m.Update(tea.KeyPressMsg{Code: 'j'})
1156 m = result.(model)
1157
1158 v2 := m.View()
1159
1160 if v1.Content == v2.Content {
1161 t.Fatal("expected view to change after scrolling in less overlay")
1162 }
1163}
1164
1165func TestModel_ResizeWithOverlay(t *testing.T) {
1166 m := newTestModel()

Callers

nothing calls this directly

Calls 3

newTestModelFunction · 0.85
UpdateMethod · 0.45
ViewMethod · 0.45

Tested by

no test coverage detected