blob: 798fa3f60a61ec1887690ede75195f884a800510 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#!/usr/bin/env bats
load '../vendor/bats-support/load'
load '../vendor/bats-assert/load'
load 'setup.sh'
load 'tmux.sh'
TOGGLE_TERM_SCRIPT_PATH="$BATS_TEST_DIRNAME/../src/toggle-term.sh"
# GIVEN a new tmux session with one pane
# WHEN we run toggle term split
# THEN we expect two panes with the new pane as active
@test 'split creates a new pane' {
assert_equal "$(tmux_pane_count)" '1'
assert_equal "$(tmux_active_panes)" '1'
run "$TOGGLE_TERM_SCRIPT_PATH" split
assert_success
assert_equal "$(tmux_pane_count)" '2'
assert_equal "$(tmux_active_panes)" '0-1'
}
# GIVEN a new tmux session with one pane
# WHEN we run toggle term split twice
# THEN we expect two panes with the first pane as active
# and zoomed in so that the second pane is hidden.
#
# 'Zooming' is the mechanism we're using to have the first
# pane take up the whole screen again. When we unzoom, we can
# then see both panes again.
@test 'toggling split changes back active pane' {
assert_equal "$(tmux_pane_count)" '1'
assert_equal "$(tmux_active_panes)" '1'
run "$TOGGLE_TERM_SCRIPT_PATH" split
assert_success
run "$TOGGLE_TERM_SCRIPT_PATH" split
assert_success
assert_equal "$(tmux_pane_count)" '2'
assert_equal "$(tmux_active_panes)" '1-0'
assert_equal "$(tmux_is_zoomed)" 'true'
}
|