Co-authored-by: Clément Drouin <clement.drouin@mistral.ai>
Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai>
Co-authored-by: Cyprien <courtot.c@gmail.com>
Co-authored-by: Guillaume LE GOFF <guillaume.lgf@gmail.com>
Co-authored-by: Jean Burellier <sheplu@users.noreply.github.com>
Co-authored-by: Kim-Adeline Miguel <51720070+kimadeline@users.noreply.github.com>
Co-authored-by: Mathias Gesbert <mathias.gesbert@mistral.ai>
Co-authored-by: Nelson PROIA <144663685+Nelson-PROIA@users.noreply.github.com>
Co-authored-by: Paul VEZIA <166131032+le-codeur-rapide@users.noreply.github.com>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Quentin <quentin.torroba@mistral.ai>
Co-authored-by: Vincent G <10739306+VinceOPS@users.noreply.github.com>
Co-authored-by: josephine-delas <57808586+josephine-delas@users.noreply.github.com>
Co-authored-by: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Laure Hugo 2026-06-25 16:08:45 +02:00 committed by GitHub
parent 725d3a56ce
commit e607ccbb00
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
242 changed files with 7372 additions and 1974 deletions

View file

@ -1,6 +1,8 @@
from __future__ import annotations
import pytest
from textual.geometry import Offset
from textual.selection import Selection
from tests.conftest import build_test_vibe_app
from vibe.cli.textual_ui.widgets.chat_input import ChatInputContainer, ChatTextArea
@ -62,3 +64,46 @@ async def test_shift_backspace_resets_mode_when_empty() -> None:
await pilot.pause(0.1)
assert text_area.input_mode == ">"
@pytest.mark.asyncio
async def test_selection_cleared_when_focus_leaves_text_area() -> 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)
text_area.load_text("hello world")
text_area.select_all()
await pilot.pause(0.1)
assert text_area.selected_text == "hello world"
app.query_one("#chat").focus()
await pilot.pause(0.1)
assert text_area.selected_text == ""
@pytest.mark.asyncio
async def test_blur_does_not_clear_other_widget_selection() -> 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.load_text("hello world")
text_area.select_all()
await pilot.pause(0.1)
chat = app.query_one("#chat")
sentinel = {chat: Selection(Offset(0, 0), Offset(0, 1))}
app.screen.selections = sentinel
text_area.screen.set_focus(chat)
await pilot.pause(0.1)
assert text_area.selected_text == ""
assert app.screen.selections == sentinel