/
githubmirror
/
lazygit
Обзор
Документация
Войти
/
githubmirror
/
lazygit
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
pkg/integration/components/confirmation_driver.go
53 строки
1 KB
Jesse Duffield
Add demo for amending old commit
02 авг 2023, 15:32
02 авг 2023, 15:32
c43195e
Код
Авторство
О чём код?
package components type ConfirmationDriver struct { t *TestDriver hasCheckedTitle bool hasCheckedContent bool } func (self *ConfirmationDriver) getViewDriver() *ViewDriver { return self.t.Views().Confirmation() } // asserts that the confirmation view has the expected title func (self *ConfirmationDriver) Title(expected *TextMatcher) *ConfirmationDriver { self.getViewDriver().Title(expected) self.hasCheckedTitle = true return self } // asserts that the confirmation view has the expected content func (self *ConfirmationDriver) Content(expected *TextMatcher) *ConfirmationDriver { self.getViewDriver().Content(expected) self.hasCheckedContent = true return self } func (self *ConfirmationDriver) Confirm() { self.checkNecessaryChecksCompleted() self.getViewDriver().PressEnter() } func (self *ConfirmationDriver) Cancel() { self.checkNecessaryChecksCompleted() self.getViewDriver().PressEscape() } func (self *ConfirmationDriver) Wait(milliseconds int) *ConfirmationDriver { self.getViewDriver().Wait(milliseconds) return self } func (self *ConfirmationDriver) checkNecessaryChecksCompleted() { if !self.hasCheckedContent || !self.hasCheckedTitle { self.t.Fail("You must both check the content and title of a confirmation popup by calling Title()/Content() before calling Confirm()/Cancel().") } }