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:
@ -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
|
||||
|
Reference in New Issue
Block a user