summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatthieu Cneude <Phantas0s@users.noreply.github.com>2024-03-29 08:14:08 +0100
committerGitHub <noreply@github.com>2024-03-29 16:14:08 +0900
commitf625c5aabe0e4cdbfc4a1d5d526a011d3c68c697 (patch)
tree304dcb5d7f6540ef40700fd71b28f99c86ee7b6a /test
parent8a74976c1f02730cfd1b83fc38a57b737a24ac9a (diff)
Add environment variables: FZF_{BORDER,PREVIEW}_LABEL (#3693)
The environment variable get the value of the preview label, even if it has been updated with an action. It can be useful to track the label of the preview and be able to switch between previews using only one binding. Co-authored-by: Junegunn Choi <junegunn.c@gmail.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/test_go.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_go.rb b/test/test_go.rb
index f44f6379..e4d365e9 100755
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -2877,6 +2877,27 @@ class TestGoFZF < TestBase
end
end
+ def test_labels_variables
+ tmux.send_keys ': | fzf --border --border-label foobar --preview "echo \$FZF_BORDER_LABEL // \$FZF_PREVIEW_LABEL" --preview-label barfoo --bind "space:change-border-label(barbaz)+change-preview-label(bazbar)+refresh-preview,enter:transform-border-label(echo 123)+transform-preview-label(echo 456)+refresh-preview"', :Enter
+ tmux.until do
+ assert_includes(_1[0], '─foobar─')
+ assert_includes(_1[1], '─barfoo─')
+ assert_includes(_1[2], ' foobar // barfoo ')
+ end
+ tmux.send_keys :Space
+ tmux.until do
+ assert_includes(_1[0], '─barbaz─')
+ assert_includes(_1[1], '─bazbar─')
+ assert_includes(_1[2], ' barbaz // bazbar ')
+ end
+ tmux.send_keys :Enter
+ tmux.until do
+ assert_includes(_1[0], '─123─')
+ assert_includes(_1[1], '─456─')
+ assert_includes(_1[2], ' 123 // 456 ')
+ end
+ end
+
def test_info_separator_unicode
tmux.send_keys 'seq 100 | fzf -q55', :Enter
tmux.until { assert_includes(_1[-2], ' 1/100 ─') }