@@ -95,6 +95,26 @@ def test_create_toolbar_tokens_func_applies_custom_format(monkeypatch) -> None:
9595 assert ("class:bottom-toolbar" , "Refreshing completions…" ) in result
9696
9797
98+ def test_create_toolbar_tokens_func_replaces_default_toolbar_for_plain_custom_format (monkeypatch ) -> None :
99+ mycli = make_mycli (multi_line = True , toolbar_error_message = 'boom' , refreshing = True )
100+ monkeypatch .setattr (clitoolbar .special , 'get_current_delimiter' , lambda : '$$' )
101+
102+ formatted = [('class:bottom-toolbar' , 'PLAIN CUSTOM' )]
103+ to_formatted_text = MagicMock (return_value = formatted )
104+ monkeypatch .setattr (clitoolbar , 'to_formatted_text' , to_formatted_text )
105+
106+ toolbar = clitoolbar .create_toolbar_tokens_func (mycli , lambda : True , 'fmt' )
107+ result = toolbar ()
108+
109+ mycli .get_custom_toolbar .assert_called_once_with ('fmt' )
110+ to_formatted_text .assert_called_once_with ('custom toolbar' , style = 'class:bottom-toolbar' )
111+ assert ('class:bottom-toolbar' , 'PLAIN CUSTOM' ) in result
112+ assert ('class:bottom-toolbar' , '[Tab] Complete' ) not in result
113+ assert ('class:bottom-toolbar' , '[F1] Help' ) not in result
114+ assert ('class:bottom-toolbar' , 'right-arrow accepts full-line suggestion' ) in result
115+ assert ('class:bottom-toolbar.transaction.failed' , 'boom' ) in result
116+
117+
98118@pytest .mark .parametrize (
99119 ('input_mode' , 'expected' ),
100120 [
0 commit comments