branch: master
commit 6b004d2eb5484839cfc0ffcef351335715993731
Author: fabacino <[email protected]>
Commit: Oleh Krehel <[email protected]>

    ivy-test.el: Add tests for selectable prompt
    
    Fixes #1059
---
 ivy-test.el | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/ivy-test.el b/ivy-test.el
index 8961ae4..77b5859 100644
--- a/ivy-test.el
+++ b/ivy-test.el
@@ -426,4 +426,80 @@
             "RET")
            "default")))
 
+(ert-deftest ivy-read-prompt ()
+  (let ((prompt "pattern: ")
+        (collection '("blue" "yellow")))
+    (should (equal
+             (ivy-with
+              '(let ((ivy-use-selectable-prompt nil))
+                 (ivy-read prompt collection))
+              "bl C-m")
+             "blue"))
+    (should (equal
+             (ivy-with
+              '(let ((ivy-use-selectable-prompt nil))
+                 (ivy-read prompt collection))
+              "bl C-p C-m")
+             "blue"))
+    (should (equal
+             (ivy-with
+              '(let ((ivy-use-selectable-prompt nil))
+                 (ivy-read prompt collection))
+              "bl C-j")
+             "blue"))
+    (should (equal
+             (ivy-with
+              '(let ((ivy-use-selectable-prompt nil))
+                 (ivy-read prompt collection))
+              "bl C-p C-j")
+             "blue"))
+    (should (equal
+             (ivy-with
+              '(let ((ivy-use-selectable-prompt nil))
+                 (ivy-read prompt collection))
+              "bl C-M-j")
+             "bl"))
+    (should (equal
+             (ivy-with
+              '(let ((ivy-use-selectable-prompt nil))
+                 (ivy-read prompt collection))
+              "bl C-p C-M-j")
+             "bl"))
+    (should (equal
+             (ivy-with
+              '(let ((ivy-use-selectable-prompt t))
+                 (ivy-read prompt collection))
+              "bl C-m")
+             "blue"))
+    (should (equal
+             (ivy-with
+              '(let ((ivy-use-selectable-prompt t))
+                 (ivy-read prompt collection))
+              "bl C-p C-m")
+             "bl"))
+    (should (equal
+             (ivy-with
+              '(let ((ivy-use-selectable-prompt t))
+                 (ivy-read prompt collection))
+              "bl C-j")
+             "blue"))
+    (should (equal
+             (ivy-with
+              '(let ((ivy-use-selectable-prompt t))
+                 (ivy-read prompt collection))
+              "bl C-p C-j")
+             "bl"))
+    (should (equal
+             (ivy-with
+              '(let ((ivy-use-selectable-prompt t))
+                 (ivy-read prompt collection))
+              "bl C-M-j")
+             "bl"))
+    (should (equal
+             (ivy-with
+              '(let ((ivy-use-selectable-prompt t))
+                 (ivy-read prompt collection))
+              "bl C-p C-M-j")
+             "bl"))))
+
 (provide 'ivy-test)

Reply via email to