aboutsummaryrefslogtreecommitdiff
path: root/tests/test-pearl-keymap.el
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-pearl-keymap.el')
-rw-r--r--tests/test-pearl-keymap.el82
1 files changed, 60 insertions, 22 deletions
diff --git a/tests/test-pearl-keymap.el b/tests/test-pearl-keymap.el
index 89fe349..643005b 100644
--- a/tests/test-pearl-keymap.el
+++ b/tests/test-pearl-keymap.el
@@ -20,10 +20,11 @@
;;; Commentary:
;; Tests for `pearl-prefix-map' and `pearl-mode'. Hot-path commands bind
-;; directly under the prefix; the rest live in category sub-maps (fetch / edit
-;; / new / delete / url). The common commands appear in both places.
-;; `pearl-mode' makes the map live inside Pearl buffers under
-;; `pearl-keymap-prefix'.
+;; directly under the prefix; the rest live in category sub-maps. Fetch
+;; (`f') is issue-fetching only; views have their own group (`v'); workspace
+;; / setup commands live under `w'. The common commands appear both as a
+;; direct hot key and inside their group. `pearl-mode' makes the map live
+;; inside Pearl buffers under `pearl-keymap-prefix'.
;;; Code:
@@ -57,48 +58,70 @@ The lowercase `c' is no longer a direct command -- it is the create prefix."
(should (eq 'pearl-menu (lookup-key pearl-prefix-map (kbd "m")))))
(ert-deftest test-pearl-prefix-map-sub-prefixes-are-verbs ()
- "Each category key is a sub-prefix keymap named for an action verb."
+ "Each category key is a sub-prefix keymap named for an action verb or noun."
(should (keymapp (lookup-key pearl-prefix-map (kbd "f")))) ; fetch
+ (should (keymapp (lookup-key pearl-prefix-map (kbd "v")))) ; views
(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
+ (should (keymapp (lookup-key pearl-prefix-map (kbd "y")))) ; copy
+ (should (keymapp (lookup-key pearl-prefix-map (kbd "w"))))) ; workspace
-(ert-deftest test-pearl-prefix-map-fetch-group ()
- "The fetch group resolves each source and view-run command."
+(ert-deftest test-pearl-prefix-map-fetch-group-is-issue-sources-only ()
+ "The fetch group resolves the four issue-source commands and nothing else.
+View-movement commands moved to the dedicated views group, so the old
+`f l' / `f v' / `f u' / `f d' / `f P' chains are gone."
(should (eq 'pearl-pick-source (lookup-key pearl-prefix-map (kbd "f s"))))
(should (eq 'pearl-list-issues (lookup-key pearl-prefix-map (kbd "f o"))))
(should (eq 'pearl-list-issues-by-project (lookup-key pearl-prefix-map (kbd "f p"))))
(should (eq 'pearl-list-issues-filtered (lookup-key pearl-prefix-map (kbd "f f"))))
- (should (eq 'pearl-run-linear-view (lookup-key pearl-prefix-map (kbd "f v"))))
- (should (eq 'pearl-run-local-view (lookup-key pearl-prefix-map (kbd "f l"))))
- (should (eq 'pearl-publish-local-view
- (lookup-key pearl-prefix-map (kbd "f u"))))
- (should (eq 'pearl-save-linear-view-locally
- (lookup-key pearl-prefix-map (kbd "f d"))))
- (should (eq 'pearl-publish-current-view
- (lookup-key pearl-prefix-map (kbd "f P")))))
+ ;; the view commands are no longer under fetch
+ (should-not (lookup-key pearl-prefix-map (kbd "f l")))
+ (should-not (lookup-key pearl-prefix-map (kbd "f v")))
+ (should-not (lookup-key pearl-prefix-map (kbd "f u")))
+ (should-not (lookup-key pearl-prefix-map (kbd "f d")))
+ (should-not (lookup-key pearl-prefix-map (kbd "f P"))))
+
+(ert-deftest test-pearl-prefix-map-views-group ()
+ "The dedicated views group gathers run / create / edit / delete / copy-direction.
+Lowercase `l'/`L' run local / Linear; `c'/`e'/`k' create / edit / delete a
+local view; `u'/`U' publish (copy up); `d' saves a Linear view locally
+\(copy down)."
+ (should (eq 'pearl-run-local-view (lookup-key pearl-prefix-map (kbd "v l"))))
+ (should (eq 'pearl-run-linear-view (lookup-key pearl-prefix-map (kbd "v L"))))
+ (should (eq 'pearl-create-local-view (lookup-key pearl-prefix-map (kbd "v c"))))
+ (should (eq 'pearl-edit-local-view (lookup-key pearl-prefix-map (kbd "v e"))))
+ (should (eq 'pearl-delete-local-view (lookup-key pearl-prefix-map (kbd "v k"))))
+ (should (eq 'pearl-publish-local-view (lookup-key pearl-prefix-map (kbd "v u"))))
+ (should (eq 'pearl-publish-current-view (lookup-key pearl-prefix-map (kbd "v U"))))
+ (should (eq 'pearl-save-linear-view-locally (lookup-key pearl-prefix-map (kbd "v d")))))
+
+(ert-deftest test-pearl-prefix-map-views-default-slot-reserved ()
+ "`v D' is reserved for the not-yet-built set-default-view; it stays unbound."
+ (should-not (lookup-key pearl-prefix-map (kbd "v D"))))
(ert-deftest test-pearl-prefix-map-edit-group ()
- "The edit group resolves each field-edit command."
+ "The edit group resolves field-edit commands only -- no view edit anymore."
(should (eq 'pearl-edit-description (lookup-key pearl-prefix-map (kbd "e d"))))
(should (eq 'pearl-edit-state (lookup-key pearl-prefix-map (kbd "e s"))))
(should (eq 'pearl-edit-assignee (lookup-key pearl-prefix-map (kbd "e a"))))
(should (eq 'pearl-edit-labels (lookup-key pearl-prefix-map (kbd "e l"))))
(should (eq 'pearl-edit-current-comment (lookup-key pearl-prefix-map (kbd "e c"))))
- (should (eq 'pearl-edit-local-view (lookup-key pearl-prefix-map (kbd "e v"))))
+ ;; view-edit moved to the views group
+ (should-not (lookup-key pearl-prefix-map (kbd "e v")))
;; 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-create-and-delete-groups ()
- "Create and delete groups resolve issue/comment plus the local-view slot."
+ "Create and delete groups resolve issue / comment only -- views moved out."
(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-create-local-view (lookup-key pearl-prefix-map (kbd "c v"))))
(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"))))
- (should (eq 'pearl-delete-local-view (lookup-key pearl-prefix-map (kbd "k v")))))
+ ;; view create / delete moved to the views group
+ (should-not (lookup-key pearl-prefix-map (kbd "c v")))
+ (should-not (lookup-key pearl-prefix-map (kbd "k v"))))
(ert-deftest test-pearl-prefix-map-open-and-copy-groups ()
"The open group resolves the two open actions; copy resolves copy-url."
@@ -106,6 +129,15 @@ The lowercase `c' is no longer a direct command -- it is the create prefix."
(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-workspace-group ()
+ "The workspace group binds account switching plus the setup commands.
+`pearl-switch-account' was previously unbound on every surface."
+ (should (eq 'pearl-switch-account (lookup-key pearl-prefix-map (kbd "w a"))))
+ (should (eq 'pearl-test-connection (lookup-key pearl-prefix-map (kbd "w t"))))
+ (should (eq 'pearl-check-setup (lookup-key pearl-prefix-map (kbd "w c"))))
+ (should (eq 'pearl-toggle-debug (lookup-key pearl-prefix-map (kbd "w !"))))
+ (should (eq 'pearl-clear-cache (lookup-key pearl-prefix-map (kbd "w x")))))
+
(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
@@ -125,8 +157,14 @@ The lowercase `c' is no longer a direct command -- it is the create prefix."
(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= "run local view"
+ (test-pearl-keymap--label-of pearl-views-map 'pearl-run-local-view)))
+ (should (string= "switch account"
+ (test-pearl-keymap--label-of pearl-workspace-map 'pearl-switch-account)))
(should (string= "+edit" (test-pearl-keymap--label-of pearl-prefix-map pearl-edit-map)))
- (should (string= "+open" (test-pearl-keymap--label-of pearl-prefix-map pearl-open-map))))
+ (should (string= "+views" (test-pearl-keymap--label-of pearl-prefix-map pearl-views-map)))
+ (should (string= "+workspace"
+ (test-pearl-keymap--label-of pearl-prefix-map pearl-workspace-map))))
(ert-deftest test-pearl-prefix-map-not-bound-at-load ()
"Loading pearl binds nothing globally; the keys are live only via pearl-mode."