mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-12-01 22:52:01 +02:00
migrate staging tests
This commit is contained in:
@@ -31,3 +31,10 @@ func (self *Actions) ContinueOnConflictsResolved() {
|
||||
Content(Contains("all merge conflicts resolved. Continue?")).
|
||||
Confirm()
|
||||
}
|
||||
|
||||
func (self *Actions) ConfirmDiscardLines() {
|
||||
self.t.ExpectPopup().Confirmation().
|
||||
Title(Equals("Unstage lines")).
|
||||
Content(Contains("Are you sure you want to delete the selected lines")).
|
||||
Confirm()
|
||||
}
|
||||
|
||||
@@ -28,7 +28,21 @@ func (self *CommitMessagePanelDriver) AddNewline() *CommitMessagePanelDriver {
|
||||
}
|
||||
|
||||
func (self *CommitMessagePanelDriver) Clear() *CommitMessagePanelDriver {
|
||||
panic("Clear method not yet implemented!")
|
||||
// clearing multiple times in case there's multiple lines
|
||||
// (the clear button only clears a single line at a time)
|
||||
maxAttempts := 100
|
||||
for i := 0; i < maxAttempts+1; i++ {
|
||||
if self.getViewDriver().getView().Buffer() == "" {
|
||||
break
|
||||
}
|
||||
|
||||
self.t.press(ClearKey)
|
||||
if i == maxAttempts {
|
||||
panic("failed to clear commit message panel")
|
||||
}
|
||||
}
|
||||
|
||||
return self
|
||||
}
|
||||
|
||||
func (self *CommitMessagePanelDriver) Confirm() {
|
||||
|
||||
@@ -37,6 +37,13 @@ func (self *TestDriver) press(keyStr string) {
|
||||
self.gui.PressKey(keyStr)
|
||||
}
|
||||
|
||||
// Should only be used in specific cases where you're doing something weird!
|
||||
// E.g. invoking a global keybinding from within a popup.
|
||||
// You probably shouldn't use this function, and should instead go through a view like t.Views().Commit().Focus().Press(...)
|
||||
func (self *TestDriver) GlobalPress(keyStr string) {
|
||||
self.press(keyStr)
|
||||
}
|
||||
|
||||
func (self *TestDriver) typeContent(content string) {
|
||||
for _, char := range content {
|
||||
self.press(string(char))
|
||||
|
||||
Reference in New Issue
Block a user