aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_split.bats
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2026-11-23 18:32:47 -0800
committerEugene Triguba <hello@eugenetriguba.com>2026-11-23 18:32:47 -0800
commitcd3885855692653a4ac7a48adabc60009e70a8ef (patch)
tree0c60a3a4bb3e6c14f72dd550ca9d7ca08019ac64 /tests/test_split.bats
parentFix format of installation config in readme file (diff)
downloadtmux-toggle-term-cd3885855692653a4ac7a48adabc60009e70a8ef.zip
Change toggle term float and split key defaults
- `@toggle-term-float-key` now defaults to `f`. - `@toggle-term-split-key` now defaults to `;`.
Diffstat (limited to 'tests/test_split.bats')
-rw-r--r--tests/test_split.bats44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/test_split.bats b/tests/test_split.bats
new file mode 100644
index 0000000..798fa3f
--- /dev/null
+++ b/tests/test_split.bats
@@ -0,0 +1,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'
+}