1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2024-12-04 10:34:55 +02:00
lazygit/pkg/integration/components/search_driver.go
2023-06-03 15:32:23 +10:00

40 lines
742 B
Go

package components
// TODO: soft-code this
const ClearKey = "<c-u>"
type SearchDriver struct {
t *TestDriver
}
func (self *SearchDriver) getViewDriver() *ViewDriver {
return self.t.Views().Search()
}
// asserts on the text initially present in the prompt
func (self *SearchDriver) InitialText(expected *TextMatcher) *SearchDriver {
self.getViewDriver().Content(expected)
return self
}
func (self *SearchDriver) Type(value string) *SearchDriver {
self.t.typeContent(value)
return self
}
func (self *SearchDriver) Clear() *SearchDriver {
self.t.press(ClearKey)
return self
}
func (self *SearchDriver) Confirm() {
self.getViewDriver().PressEnter()
}
func (self *SearchDriver) Cancel() {
self.getViewDriver().PressEscape()
}