Skip to content

Commit b1944da

Browse files
committed
test(Session.new_window): Test with direction
1 parent 0a6ac89 commit b1944da

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/test_session.py

+31
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,37 @@ def test_new_window_with_environment_logs_warning_for_old_tmux(
330330
), "Warning missing"
331331

332332

333+
@pytest.mark.skipif(
334+
has_lt_version("3.2"),
335+
reason="Only 3.2+ has the -a and -b flag on new-window",
336+
)
337+
def test_session_new_window_with_direction(
338+
session: Session,
339+
) -> None:
340+
"""Verify new window with direction."""
341+
window = session.active_window
342+
window.refresh()
343+
344+
window_initial = session.new_window(window_name="Example")
345+
assert window_initial.window_index == "2"
346+
347+
window_before = session.new_window(
348+
window_name="Window before", direction=NewWindowDirection.Before
349+
)
350+
window_initial.refresh()
351+
assert window_before.window_index == "1"
352+
assert window_initial.window_index == "3"
353+
354+
window_after = session.new_window(
355+
window_name="Window after", direction=NewWindowDirection.After
356+
)
357+
window_initial.refresh()
358+
window_after.refresh()
359+
assert window_after.window_index == "3"
360+
assert window_initial.window_index == "4"
361+
assert window_before.window_index == "1"
362+
363+
333364
@pytest.mark.skipif(
334365
has_gte_version("3.1"),
335366
reason="Only 3.1 has the -a and -b flag on new-window",

0 commit comments

Comments
 (0)