v2.18.2 (#857)
Co-authored-by: Cyprien <courtot.c@gmail.com> Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com> Co-authored-by: Laure Hugo <201583486+laure0303@users.noreply.github.com> Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com> Co-authored-by: Peter Evers <peter.evers@mistral.ai> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Yousria <yousria.debaud@mistral.ai> Co-authored-by: renovate-mistral[bot] <253709520+renovate-mistral[bot]@users.noreply.github.com> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
ed5b7192e6
commit
d50704e694
110 changed files with 1663 additions and 764 deletions
|
|
@ -4,6 +4,7 @@ from unittest.mock import patch
|
|||
|
||||
from pydantic import BaseModel
|
||||
import pytest
|
||||
from textual import events
|
||||
|
||||
from vibe.cli.textual_ui.widgets.approval_app import ApprovalApp
|
||||
from vibe.core.config import VibeConfig
|
||||
|
|
@ -76,3 +77,36 @@ class TestGracePeriod:
|
|||
assert approval_app.selected_option == 1
|
||||
approval_app.action_move_up()
|
||||
assert approval_app.selected_option == 0
|
||||
|
||||
|
||||
class TestVimKeybindings:
|
||||
def test_j_moves_down(self, approval_app: ApprovalApp):
|
||||
with patch.object(approval_app, "_update_options"):
|
||||
assert approval_app.selected_option == 0
|
||||
|
||||
approval_app.on_key(events.Key("j", "j"))
|
||||
|
||||
assert approval_app.selected_option == 1
|
||||
|
||||
def test_k_moves_up(self, approval_app: ApprovalApp):
|
||||
with patch.object(approval_app, "_update_options"):
|
||||
assert approval_app.selected_option == 0
|
||||
|
||||
approval_app.on_key(events.Key("k", "k"))
|
||||
|
||||
# Wraps to last option (index 3)
|
||||
assert approval_app.selected_option == 3
|
||||
|
||||
def test_vim_navigation_works_during_grace_period(self, approval_app: ApprovalApp):
|
||||
with (
|
||||
patch("vibe.cli.textual_ui.widgets.approval_app.time") as mock_time,
|
||||
patch.object(approval_app, "_update_options"),
|
||||
):
|
||||
mock_time.monotonic.return_value = 100.0 + 0.01
|
||||
assert approval_app.is_within_grace_period()
|
||||
|
||||
assert approval_app.selected_option == 0
|
||||
approval_app.on_key(events.Key("j", "j"))
|
||||
assert approval_app.selected_option == 1
|
||||
approval_app.on_key(events.Key("k", "k"))
|
||||
assert approval_app.selected_option == 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue