mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-04-25 12:24:47 +02:00
pretty sure we can rely on our views existing before our contexts do
This commit is contained in:
parent
182c999ee0
commit
e2f5fe1016
@ -1,41 +0,0 @@
|
|||||||
package gui
|
|
||||||
|
|
||||||
import (
|
|
||||||
"testing"
|
|
||||||
|
|
||||||
"github.com/jesseduffield/gocui"
|
|
||||||
"github.com/jesseduffield/lazygit/pkg/gui/types"
|
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestCanDeactivatePopupContextsWithoutViews(t *testing.T) {
|
|
||||||
contexts := []func(gui *Gui) types.Context{
|
|
||||||
func(gui *Gui) types.Context { return gui.State.Contexts.Credentials },
|
|
||||||
func(gui *Gui) types.Context { return gui.State.Contexts.Confirmation },
|
|
||||||
func(gui *Gui) types.Context { return gui.State.Contexts.CommitMessage },
|
|
||||||
func(gui *Gui) types.Context { return gui.State.Contexts.Search },
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, c := range contexts {
|
|
||||||
gui := NewDummyGui()
|
|
||||||
context := c(gui)
|
|
||||||
gui.g = &gocui.Gui{}
|
|
||||||
|
|
||||||
_ = gui.deactivateContext(context)
|
|
||||||
|
|
||||||
// This really only checks a prerequisit, not the effect of deactivateContext
|
|
||||||
view, _ := gui.g.View(context.GetViewName())
|
|
||||||
assert.Nil(t, view, string(context.GetKey()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestCanDeactivateCommitFilesContextsWithoutViews(t *testing.T) {
|
|
||||||
gui := NewDummyGui()
|
|
||||||
gui.g = &gocui.Gui{}
|
|
||||||
|
|
||||||
_ = gui.deactivateContext(gui.State.Contexts.CommitFiles)
|
|
||||||
|
|
||||||
// This really only checks a prerequisite, not the effect of deactivateContext
|
|
||||||
view, _ := gui.g.View(gui.State.Contexts.CommitFiles.GetViewName())
|
|
||||||
assert.Nil(t, view)
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user