Skip to content

Commit fad6a94

Browse files
committed
test(new_window): Test with direction
1 parent 62ac6d4 commit fad6a94

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

tests/test_window.py

+31
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,37 @@ def test_resize(
512512
assert window_height_before < window_height_expanded
513513

514514

515+
@pytest.mark.skipif(
516+
has_lt_version("3.2"),
517+
reason="Only 3.2+ has the -a and -b flag on new-window",
518+
)
519+
def test_new_window_with_direction(
520+
session: Session,
521+
) -> None:
522+
"""Verify new window with direction."""
523+
window = session.active_window
524+
window.refresh()
525+
526+
window_initial = session.new_window(window_name="Example")
527+
assert window_initial.window_index == "2"
528+
529+
window_before = session.new_window(
530+
window_name="Window before", direction=NewWindowDirection.Before
531+
)
532+
window_initial.refresh()
533+
assert window_before.window_index == "1"
534+
assert window_initial.window_index == "3"
535+
536+
window_after = session.new_window(
537+
window_name="Window after", direction=NewWindowDirection.Before
538+
)
539+
window_initial.refresh()
540+
window_after.refresh()
541+
assert window_after.window_index == "2"
542+
assert window_initial.window_index == "4"
543+
assert window_before.window_index == "1"
544+
545+
515546
@pytest.mark.skipif(
516547
has_gte_version("3.2"),
517548
reason="Only 3.2+ has the -a and -b flag on new-window",

0 commit comments

Comments
 (0)