diff --git a/test/beaupy_select_multiple_test.py b/test/beaupy_select_multiple_test.py index f9471d2..3627207 100644 --- a/test/beaupy_select_multiple_test.py +++ b/test/beaupy_select_multiple_test.py @@ -713,3 +713,28 @@ def _(): assert Live.update.call_count == 3 assert res == ["test1"] + + +@test("`select_multiple` with 2 options, second of which is styled, starting from first selecting going down and selecting second also") +def _(): + steps = iter([" ", Keys.DOWN_ARROW, " ", Keys.ENTER]) + + b.get_key = lambda: next(steps) + Live.update = mock.MagicMock() + res = select_multiple(options=["test1", "[yellow1]test2[/yellow1]"], tick_character="😋") + assert Live.update.call_args_list == [ + mock.call( + renderable="\\[ ] [pink1]test1[/pink1]\n\\[ ] [yellow1]test2[/yellow1]\n\n(Mark with [bold]space[/bold], confirm with [bold]enter[/bold])" + ), + mock.call( + renderable="\\[[pink1]😋[/pink1]] [pink1]test1[/pink1]\n\\[ ] [yellow1]test2[/yellow1]\n\n(Mark with [bold]space[/bold], confirm with [bold]enter[/bold])" + ), + mock.call( + renderable="\\[[pink1]😋[/pink1]] test1\n\\[ ] [pink1][pink1]test2[/pink1][/pink1]\n\n(Mark with [bold]space[/bold], confirm with [bold]enter[/bold])" + ), + mock.call( + renderable="\\[[pink1]😋[/pink1]] test1\n\\[[pink1]😋[/pink1]] [pink1][pink1]test2[/pink1][/pink1]\n\n(Mark with [bold]space[/bold], confirm with [bold]enter[/bold])" + ), + ] + assert Live.update.call_count == 4 + assert res == ["test1", "[yellow1]test2[/yellow1]"]