Skip to content

Commit

Permalink
tests(Window): set_option
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Feb 6, 2024
1 parent 5550f06 commit 78c2a84
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/legacy_api/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def test_show_window_options(session: Session) -> None:


def test_set_window_and_show_window_options(session: Session) -> None:
"""Set option then Window.show_window_options(key)."""
"""Window.set_window_option() then Window.show_window_options(key)."""
window = session.new_window(window_name="test_window")

window.set_window_option("main-pane-height", 20)
Expand All @@ -225,6 +225,22 @@ def test_set_window_and_show_window_options(session: Session) -> None:
assert window.show_window_option("pane-border-format") == " #P "


def test_set_and_show_window_options(session: Session) -> None:
"""Window.set_option() then Window.show_window_options(key)."""
window = session.new_window(window_name="test_window")

window.set_option("main-pane-height", 20)
assert window.show_window_option("main-pane-height") == 20

window.set_option("main-pane-height", 40)
assert window.show_window_option("main-pane-height") == 40
assert window.show_window_options()["main-pane-height"] == 40

if has_gte_version("2.3"):
window.set_option("pane-border-format", " #P ")
assert window.show_window_option("pane-border-format") == " #P "


def test_empty_window_option_returns_None(session: Session) -> None:
"""Verify unset window option returns None."""
window = session.new_window(window_name="test_window")
Expand Down
16 changes: 16 additions & 0 deletions tests/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,22 @@ def test_set_window_and_show_window_options(session: Session) -> None:
assert window.show_window_option("pane-border-format") == " #P "


def test_set_and_show_window_options(session: Session) -> None:
"""Window.set_option() then Window.show_window_options(key)."""
window = session.new_window(window_name="test_window")

window.set_option("main-pane-height", 20)
assert window.show_window_option("main-pane-height") == 20

window.set_option("main-pane-height", 40)
assert window.show_window_option("main-pane-height") == 40
assert window.show_window_options()["main-pane-height"] == 40

if has_gte_version("2.3"):
window.set_option("pane-border-format", " #P ")
assert window.show_window_option("pane-border-format") == " #P "


def test_empty_window_option_returns_None(session: Session) -> None:
"""Verify unset window option returns None."""
window = session.new_window(window_name="test_window")
Expand Down

0 comments on commit 78c2a84

Please sign in to comment.