From 7837a88380da6057b81d1f741d39a79bc83993c0 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 25 Oct 2025 10:27:06 -0400 Subject: Add ability to disable float or split functionality --- tests/tests.sh | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) (limited to 'tests') diff --git a/tests/tests.sh b/tests/tests.sh index bf9204e..88e34aa 100644 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -185,3 +185,96 @@ load_plugin() { run tmux_has_prefix_binding "C-;" "split" assert_failure } + +@test 'both float and split are enabled by default' { + run load_plugin + assert_success + + run tmux_has_root_binding "C-f" "float" + assert_success + run tmux_has_root_binding "C-;" "split" + assert_success +} + +@test 'float can be disabled' { + tmux_set_option "@toggle-term-float-enabled" "false" + + run load_plugin + assert_success + + run tmux_has_root_binding "C-f" "float" + assert_failure + run tmux_has_root_binding "C-;" "split" + assert_success +} + +@test 'split can be disabled' { + tmux_set_option "@toggle-term-split-enabled" "false" + + run load_plugin + assert_success + + run tmux_has_root_binding "C-f" "float" + assert_success + run tmux_has_root_binding "C-;" "split" + assert_failure +} + +@test 'both float and split can be disabled' { + tmux_set_option "@toggle-term-float-enabled" "false" + tmux_set_option "@toggle-term-split-enabled" "false" + + run load_plugin + assert_success + + run tmux_has_root_binding "C-f" "float" + assert_failure + run tmux_has_root_binding "C-;" "split" + assert_failure +} + +@test 'disabled float does not bind with custom key' { + tmux_set_option "@toggle-term-float-enabled" "false" + tmux_set_option "@toggle-term-float-key" "M-f" + + run load_plugin + assert_success + + run tmux_has_root_binding "M-f" "float" + assert_failure +} + +@test 'disabled split does not bind with custom key' { + tmux_set_option "@toggle-term-split-enabled" "false" + tmux_set_option "@toggle-term-split-key" "M-t" + + run load_plugin + assert_success + + run tmux_has_root_binding "M-t" "split" + assert_failure +} + +@test 'disabled float does not bind with prefix' { + tmux_set_option "@toggle-term-float-enabled" "false" + tmux_set_option "@toggle-term-float-key" "f" + tmux_set_option "@toggle-term-float-use-prefix" "true" + + run load_plugin + assert_success + + run tmux_has_prefix_binding "f" "float" + assert_failure +} + +@test 'disabled split does not bind with prefix' { + tmux_set_option "@toggle-term-split-enabled" "false" + tmux_set_option "@toggle-term-split-key" "f" + tmux_set_option "@toggle-term-split-use-prefix" "true" + + run load_plugin + assert_success + + run tmux_has_prefix_binding "f" "split" + assert_failure +} -- cgit v1.2.3