Co-authored-by: Clément Sirieix <clement.sirieix@mistral.ai>
Co-authored-by: Kim-Adeline Miguel <kimadeline.miguel@mistral.ai>
Co-authored-by: Lucas Marandat <31749711+lucasmrdt@users.noreply.github.com>
Co-authored-by: Michel Thomazo <51709227+michelTho@users.noreply.github.com>
Co-authored-by: Paul Cacheux <paul.cacheux@mistral.ai>
Co-authored-by: Peter Evers <pevers90@gmail.com>
Co-authored-by: Pierre Rossinès <pierre.rossines@mistral.ai>
Co-authored-by: Pierre Rossinès <pierre.rossines@protonmail.com>
Co-authored-by: Quentin <quentin.torroba@mistral.ai>
Co-authored-by: Simon Van de Kerckhove <simon.vandekerckhove@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: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Mathias Gesbert 2026-04-09 18:40:46 +02:00 committed by GitHub
parent 90763daf81
commit e9a9217cc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
113 changed files with 7202 additions and 541 deletions

View file

@ -124,10 +124,7 @@ def test_copy_selection_to_clipboard_success(
assert result == "selected text"
mock_copy_to_clipboard.assert_called_once_with("selected text")
mock_app.notify.assert_called_once_with(
'"selected text" copied to clipboard',
severity="information",
timeout=2,
markup=False,
"Selection copied to clipboard", severity="information", timeout=2, markup=False
)
@ -170,32 +167,13 @@ def test_copy_selection_to_clipboard_multiple_widgets(mock_app: MagicMock) -> No
"first selection\nsecond selection"
)
mock_app.notify.assert_called_once_with(
'"first selection\u23cesecond selection" copied to clipboard',
"Selection copied to clipboard",
severity="information",
timeout=2,
markup=False,
)
def test_copy_selection_to_clipboard_preview_shortening(mock_app: MagicMock) -> None:
long_text = "a" * 100
widget = MockWidget(
text_selection=SimpleNamespace(), get_selection_result=(long_text, None)
)
mock_app.query.return_value = [widget]
with patch("vibe.cli.clipboard._copy_to_clipboard") as mock_copy_to_clipboard:
result = copy_selection_to_clipboard(mock_app)
assert result == long_text
mock_copy_to_clipboard.assert_called_once_with(long_text)
notification_call = mock_app.notify.call_args
assert notification_call is not None
assert '"' in notification_call[0][0]
assert "copied to clipboard" in notification_call[0][0]
assert len(notification_call[0][0]) < len(long_text) + 30
def test_copy_to_clipboard_stops_after_verified_copy() -> None:
"""Stops iterating once _read_clipboard confirms the text landed."""
mock_first = MagicMock()