diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-02 11:56:55 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-02 11:56:55 -0500 |
| commit | 0dccaaee955c99d2affcf33c145feba2ef1fdcda (patch) | |
| tree | d34273a2a01a5866d118daad1a84fe47ccb9fd1f /tests | |
| parent | 93c70b2b42174caa101d3de1fc46630dcdbcf941 (diff) | |
| download | pearl-0dccaaee955c99d2affcf33c145feba2ef1fdcda.tar.gz pearl-0dccaaee955c99d2affcf33c145feba2ef1fdcda.zip | |
feat(keys): dedicated views group, de-overloaded fetch, account binding
The C-; L keymap and the transient menu had drifted into two different letter schemes for the same commands, the fetch sub-map carried both issue-fetching and view-movement, and pearl-switch-account was bound nowhere.
Give views their own group under v: l/L run local/Linear, c/e/k create/edit/delete, u/U publish local/current, d save a Linear view locally. Fetch (f) is now issue sources only. A new workspace group (w) binds switch-account plus the setup commands, which previously lived only in the transient. v D is reserved, unbound, for the not-yet-built set-default-view.
The transient already had an issue-only fetch group and a dedicated views group, so its changes are additive: switch-account and copy-issue-url were both missing from the menu and are added, and save/save-all/edit-description take s/S/d to match the keymap's hot keys. Matching those three cascades a few view and edit letters because the transient is a flat keyspace where every command needs a unique key.
Suite 789 to 792, compile and lint clean.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-pearl-keymap.el | 82 | ||||
| -rw-r--r-- | tests/test-pearl-menu.el | 6 |
2 files changed, 65 insertions, 23 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." diff --git a/tests/test-pearl-menu.el b/tests/test-pearl-menu.el index 9c97384..8e18274 100644 --- a/tests/test-pearl-menu.el +++ b/tests/test-pearl-menu.el @@ -69,7 +69,11 @@ menu entry that still points at it fails here." pearl-edit-state pearl-create-comment pearl-create-issue - pearl-delete-current-issue)) + pearl-delete-current-issue + ;; previously missing from the menu -- added in the + ;; keybinding reconciliation so both surfaces agree + pearl-switch-account + pearl-copy-issue-url)) (should (memq expected cmds))))) (provide 'test-pearl-menu) |
