Co-authored-by: Alexis Tacnet <alexis@mistral.ai> Co-authored-by: Clément Drouin <clement.drouin@mistral.ai> Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com> Co-authored-by: Lucas Marandat <31749711+lucasmrdt@users.noreply.github.com> Co-authored-by: Maxime Dolores <maxime.dolores@ext.mistral.ai> Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai> Co-authored-by: Quentin <quentin.torroba@mistral.ai> Co-authored-by: Val <102326092+vdeva@users.noreply.github.com> Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com> Co-authored-by: p.vezia <166131032+le-codeur-rapide@users.noreply.github.com> Co-authored-by: Hiba Chaabnia <Hiba-Chaabnia@users.noreply.github.com> Co-authored-by: Nikhil Bhima <nikhilbhima@users.noreply.github.com> Co-authored-by: Nkipohcs <Nkipohcs@users.noreply.github.com> Co-authored-by: Mistral Vibe <vibe@mistral.ai>
64 lines
1.8 KiB
Python
64 lines
1.8 KiB
Python
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from tests.conftest import build_test_vibe_app
|
|
from vibe.cli.textual_ui.widgets.chat_input import ChatInputContainer, ChatTextArea
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_shift_backspace_deletes_character_like_backspace() -> None:
|
|
app = build_test_vibe_app()
|
|
async with app.run_test() as pilot:
|
|
await pilot.pause(0.1)
|
|
|
|
text_area = app.query_one(ChatTextArea)
|
|
text_area.focus()
|
|
await pilot.pause(0.1)
|
|
|
|
await pilot.press("a", "b", "c")
|
|
await pilot.pause(0.1)
|
|
assert app.query_one(ChatInputContainer).value == "abc"
|
|
|
|
await pilot.press("shift+backspace")
|
|
await pilot.pause(0.1)
|
|
|
|
assert app.query_one(ChatInputContainer).value == "ab"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_shift_delete_deletes_character_like_delete() -> None:
|
|
app = build_test_vibe_app()
|
|
async with app.run_test() as pilot:
|
|
await pilot.pause(0.1)
|
|
|
|
text_area = app.query_one(ChatTextArea)
|
|
text_area.focus()
|
|
await pilot.pause(0.1)
|
|
|
|
await pilot.press("a", "b", "c", "left")
|
|
await pilot.pause(0.1)
|
|
assert app.query_one(ChatInputContainer).value == "abc"
|
|
|
|
await pilot.press("shift+delete")
|
|
await pilot.pause(0.1)
|
|
|
|
assert app.query_one(ChatInputContainer).value == "ab"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_shift_backspace_resets_mode_when_empty() -> None:
|
|
app = build_test_vibe_app()
|
|
async with app.run_test() as pilot:
|
|
await pilot.pause(0.1)
|
|
|
|
text_area = app.query_one(ChatTextArea)
|
|
text_area.focus()
|
|
text_area.set_mode("!")
|
|
await pilot.pause(0.1)
|
|
assert text_area.input_mode == "!"
|
|
|
|
await pilot.press("shift+backspace")
|
|
await pilot.pause(0.1)
|
|
|
|
assert text_area.input_mode == ">"
|