diff options
Diffstat (limited to 'tests/test-pearl-keymap.el')
| -rw-r--r-- | tests/test-pearl-keymap.el | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/tests/test-pearl-keymap.el b/tests/test-pearl-keymap.el index 25b63d9..b465395 100644 --- a/tests/test-pearl-keymap.el +++ b/tests/test-pearl-keymap.el @@ -46,23 +46,24 @@ Walks MAP looking for a labeled binding (\"label\" . COMMAND)." (should (keymapp pearl-prefix-map))) (ert-deftest test-pearl-prefix-map-direct-hot-keys () - "The hot-path commands resolve in one key under the prefix." + "The hot-path commands resolve in one key under the prefix. +The lowercase `c' is no longer a direct command -- it is the create prefix." (should (eq 'pearl-list-issues (lookup-key pearl-prefix-map (kbd "l")))) (should (eq 'pearl-refresh-current-view (lookup-key pearl-prefix-map (kbd "g")))) (should (eq 'pearl-refresh-current-issue (lookup-key pearl-prefix-map (kbd "r")))) (should (eq 'pearl-save-issue (lookup-key pearl-prefix-map (kbd "s")))) (should (eq 'pearl-save-all (lookup-key pearl-prefix-map (kbd "S")))) (should (eq 'pearl-edit-description (lookup-key pearl-prefix-map (kbd "d")))) - (should (eq 'pearl-add-comment (lookup-key pearl-prefix-map (kbd "c")))) (should (eq 'pearl-menu (lookup-key pearl-prefix-map (kbd "m"))))) -(ert-deftest test-pearl-prefix-map-sub-prefixes-are-keymaps () - "The category keys are sub-prefixes, not commands." - (should (keymapp (lookup-key pearl-prefix-map (kbd "f")))) - (should (keymapp (lookup-key pearl-prefix-map (kbd "e")))) - (should (keymapp (lookup-key pearl-prefix-map (kbd "n")))) - (should (keymapp (lookup-key pearl-prefix-map (kbd "k")))) - (should (keymapp (lookup-key pearl-prefix-map (kbd "u"))))) +(ert-deftest test-pearl-prefix-map-sub-prefixes-are-verbs () + "Each category key is a sub-prefix keymap named for an action verb." + (should (keymapp (lookup-key pearl-prefix-map (kbd "f")))) ; fetch + (should (keymapp (lookup-key pearl-prefix-map (kbd "e")))) ; edit + (should (keymapp (lookup-key pearl-prefix-map (kbd "c")))) ; create + (should (keymapp (lookup-key pearl-prefix-map (kbd "k")))) ; delete + (should (keymapp (lookup-key pearl-prefix-map (kbd "o")))) ; open + (should (keymapp (lookup-key pearl-prefix-map (kbd "y"))))) ; copy (ert-deftest test-pearl-prefix-map-fetch-group () "The fetch group resolves each source command." @@ -82,27 +83,24 @@ Walks MAP looking for a labeled binding (\"label\" . COMMAND)." ;; priority has no edit command (org-native cookie); e p is unbound (should-not (lookup-key pearl-prefix-map (kbd "e p")))) -(ert-deftest test-pearl-prefix-map-new-and-delete-groups () - "New and delete groups resolve ticket/comment, with delete under k." - (should (eq 'pearl-new-issue (lookup-key pearl-prefix-map (kbd "n t")))) - (should (eq 'pearl-add-comment (lookup-key pearl-prefix-map (kbd "n c")))) +(ert-deftest test-pearl-prefix-map-create-and-delete-groups () + "Create and delete groups resolve issue/comment under c and k." + (should (eq 'pearl-create-issue (lookup-key pearl-prefix-map (kbd "c t")))) + (should (eq 'pearl-create-comment (lookup-key pearl-prefix-map (kbd "c c")))) (should (eq 'pearl-delete-current-issue (lookup-key pearl-prefix-map (kbd "k t")))) (should (eq 'pearl-delete-current-comment (lookup-key pearl-prefix-map (kbd "k c"))))) -(ert-deftest test-pearl-prefix-map-url-group () - "The url group resolves open-in-browser, copy-url, and open-view." - (should (eq 'pearl-open-current-issue (lookup-key pearl-prefix-map (kbd "u o")))) - (should (eq 'pearl-copy-issue-url (lookup-key pearl-prefix-map (kbd "u c")))) - (should (eq 'pearl-open-current-view-in-linear (lookup-key pearl-prefix-map (kbd "u v"))))) +(ert-deftest test-pearl-prefix-map-open-and-copy-groups () + "The open group resolves the two open actions; copy resolves copy-url." + (should (eq 'pearl-open-current-issue (lookup-key pearl-prefix-map (kbd "o i")))) + (should (eq 'pearl-open-current-view-in-linear (lookup-key pearl-prefix-map (kbd "o v")))) + (should (eq 'pearl-copy-issue-url (lookup-key pearl-prefix-map (kbd "y u"))))) (ert-deftest test-pearl-prefix-map-common-commands-bound-twice () "The most common commands resolve both directly and inside their group." ;; edit-description: direct d and e d (should (eq (lookup-key pearl-prefix-map (kbd "d")) (lookup-key pearl-prefix-map (kbd "e d")))) - ;; new comment: direct c and n c - (should (eq (lookup-key pearl-prefix-map (kbd "c")) - (lookup-key pearl-prefix-map (kbd "n c")))) ;; list issues: direct l and f o (should (eq (lookup-key pearl-prefix-map (kbd "l")) (lookup-key pearl-prefix-map (kbd "f o"))))) @@ -111,12 +109,14 @@ Walks MAP looking for a labeled binding (\"label\" . COMMAND)." "Leaf bindings carry verb labels; sub-prefixes carry +labels." (should (string= "edit state" (test-pearl-keymap--label-of pearl-edit-map 'pearl-edit-state))) - (should (string= "new ticket" - (test-pearl-keymap--label-of pearl-new-map 'pearl-new-issue))) + (should (string= "create issue" + (test-pearl-keymap--label-of pearl-create-map 'pearl-create-issue))) (should (string= "open issue in browser" - (test-pearl-keymap--label-of pearl-url-map 'pearl-open-current-issue))) + (test-pearl-keymap--label-of pearl-open-map 'pearl-open-current-issue))) + (should (string= "copy issue URL" + (test-pearl-keymap--label-of pearl-copy-map 'pearl-copy-issue-url))) (should (string= "+edit" (test-pearl-keymap--label-of pearl-prefix-map pearl-edit-map))) - (should (string= "+url" (test-pearl-keymap--label-of pearl-prefix-map pearl-url-map)))) + (should (string= "+open" (test-pearl-keymap--label-of pearl-prefix-map pearl-open-map)))) (ert-deftest test-pearl-prefix-map-not-bound-at-load () "Loading pearl binds nothing globally; the keys are live only via pearl-mode." |
