Skip to content

Commit

Permalink
test: styles consolidated as expected
Browse files Browse the repository at this point in the history
  • Loading branch information
petereon committed Apr 15, 2023
1 parent 5426457 commit b213b22
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/beaupy_select_multiple_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]"]

0 comments on commit b213b22

Please sign in to comment.