Skip to content

Commit c3d5d15

Browse files
committed
HACK: fix integration tests
This is not how it should be solved, but I don't have a better idea, as we can't assert on toasts in integration tests.
1 parent c3205ff commit c3d5d15

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pkg/gui/context/menu_context.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ func (self *MenuContext) GetKeybindings(opts types.KeybindingsOpts) []*types.Bin
173173

174174
func (self *MenuContext) OnMenuPress(selectedItem *types.MenuItem) error {
175175
if selectedItem != nil && selectedItem.DisabledReason != "" {
176+
if self.c.RunningIntegrationTest() {
177+
return self.c.ErrorMsg(selectedItem.DisabledReason)
178+
}
176179
self.c.ErrorToast(self.c.Tr.DisabledMenuItemPrefix + selectedItem.DisabledReason)
177180
return nil
178181
}

pkg/gui/keybindings.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,9 @@ func (gui *Gui) callKeybindingHandler(binding *types.Binding) error {
416416
disabledReason = binding.GetDisabledReason()
417417
}
418418
if disabledReason != "" {
419+
if gui.c.RunningIntegrationTest() {
420+
return gui.c.ErrorMsg(disabledReason)
421+
}
419422
gui.c.ErrorToast(gui.Tr.DisabledMenuItemPrefix + disabledReason)
420423
return nil
421424
}

0 commit comments

Comments
 (0)