summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-03-14 16:46:23 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-03-14 16:46:23 +0900
commit4298c0b1eb31b7563eb608e3fbf4069488ada08d (patch)
treeabca5dae422106c0ccc59e0070a9383995330777 /test
parent6c104d771e382f499025a35b10f39d997ce83b7d (diff)
downloadfzf-4298c0b1eb31b7563eb608e3fbf4069488ada08d.tar.gz
Add `--ghost=TEXT` to display a ghost text when the input is empty
Diffstat (limited to 'test')
-rw-r--r--test/test_core.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_core.rb b/test/test_core.rb
index 59cdfac4..882d68c5 100644
--- a/test/test_core.rb
+++ b/test/test_core.rb
@@ -1813,4 +1813,22 @@ class TestCore < TestInteractive
assert_equal ['[0] 1st: foo, 3rd: baz, 2nd: bar'], File.readlines(tempname, chomp: true)
end
end
+
+ def test_ghost
+ tmux.send_keys %(seq 100 | #{FZF} --prompt 'X ' --ghost 'Type in query ...'), :Enter
+ tmux.until do |lines|
+ assert_equal 100, lines.match_count
+ assert_includes lines, 'X Type in query ...'
+ end
+ tmux.send_keys '100'
+ tmux.until do |lines|
+ assert_equal 1, lines.match_count
+ assert_includes lines, 'X 100'
+ end
+ tmux.send_keys 'C-u'
+ tmux.until do |lines|
+ assert_equal 100, lines.match_count
+ assert_includes lines, 'X Type in query ...'
+ end
+ end
end