aboutsummaryrefslogtreecommitdiffstats
path: root/tests/tests.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/tests.sh')
-rw-r--r--tests/tests.sh93
1 files changed, 93 insertions, 0 deletions
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
+}