1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-30 03:23:08 +03:00

Make it possible to handle toasts in integration tests

Use it in two selected tests to demonstrate what it looks like.
This commit is contained in:
Stefan Haller
2024-01-12 08:12:39 +01:00
parent 37590a495c
commit 9fa43394fe
13 changed files with 49 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import (
"time"
"github.com/jesseduffield/gocui"
"github.com/jesseduffield/lazygit/pkg/gui/popup"
"github.com/jesseduffield/lazygit/pkg/integration/components"
"github.com/jesseduffield/lazygit/pkg/utils"
)
@ -32,7 +33,11 @@ func (gui *Gui) handleTestMode() {
go func() {
waitUntilIdle()
test.Run(&GuiDriver{gui: gui, isIdleChan: isIdleChan})
toastChan := make(chan string, 100)
gui.PopupHandler.(*popup.PopupHandler).SetToastFunc(
func(message string) { toastChan <- message })
test.Run(&GuiDriver{gui: gui, isIdleChan: isIdleChan, toastChan: toastChan})
gui.g.Update(func(*gocui.Gui) error {
return gocui.ErrQuit