MCPcopy Create free account
hub / github.com/cli/cli / TestBrowseModelShowsKeyboardHelp

Function TestBrowseModelShowsKeyboardHelp

pkg/cmd/extension/browse/model_test.go:336–358  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

334}
335
336func TestBrowseModelShowsKeyboardHelp(t *testing.T) {
337 t.Parallel()
338
339 // Given the main extension catalog is displayed
340 ios, _, _, _ := iostreams.Test()
341 ios.SetColorEnabled(true)
342 model := newBrowseModel(ExtBrowseOpts{IO: ios}, []extEntry{
343 {FullName: "cli/gh-cool", description: "terminal tools"},
344 })
345
346 // When the user presses ?
347 updateBrowseModel(t, model, keyPress('?'))
348
349 // Then the interface displays the available control groups
350 view := model.View().Content
351 assert.Contains(t, view, "Application")
352 assert.Contains(t, view, "Navigation")
353 assert.Contains(t, view, "Extension Management")
354 assert.Contains(t, view, "Filtering")
355 assert.Contains(t, view, "Readmes")
356 assert.Regexp(t, `\x1b\[[0-9;]*1[0-9;]*mApplication\x1b\[0m`, view)
357 assert.Regexp(t, `\x1b\[[0-9;]*1[0-9;]*m\?\x1b\[0m: toggle help`, view)
358}
359
360func TestBrowseModelShowsKeyboardHelpForShiftedQuestionMark(t *testing.T) {
361 t.Parallel()

Callers

nothing calls this directly

Calls 7

TestFunction · 0.92
newBrowseModelFunction · 0.85
updateBrowseModelFunction · 0.85
keyPressFunction · 0.85
SetColorEnabledMethod · 0.80
ContainsMethod · 0.80
ViewMethod · 0.65

Tested by

no test coverage detected