diff options
| author | Craig Jennings <c@cjennings.net> | 2026-02-20 13:31:36 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-02-20 13:31:36 -0600 |
| commit | e7b8c249b67ee999e506918a10ce7dd56e45ded0 (patch) | |
| tree | 013325614e95071aecb2de9011bf974f66cea18d /tests | |
| parent | a180ba28b966f080d2692d15eef6fb387c074ac3 (diff) | |
fix(mousetrap): use buffer-local keymaps via emulation-mode-map-alists
minor-mode-map-alist is global, so the last buffer to set its keymap
won for all buffers. Dashboard's scroll+primary profile was immediately
overwritten by other buffers' disabled profile. Switch to
emulation-mode-map-alists with a buffer-local variable so each buffer
gets its own independent keymap. Fixes dashboard click navigation.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-integration-mousetrap-mode-lighter-click.el | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/test-integration-mousetrap-mode-lighter-click.el b/tests/test-integration-mousetrap-mode-lighter-click.el index b9f32fda..252e0cf5 100644 --- a/tests/test-integration-mousetrap-mode-lighter-click.el +++ b/tests/test-integration-mousetrap-mode-lighter-click.el @@ -35,7 +35,7 @@ Dashboard uses scroll+primary profile which allows scrolling and mouse-1." (should (eq (lookup-key mouse-trap-mode-map (kbd "<wheel-up>")) nil)) ;; Keymap should be in minor-mode-map-alist - (should (assq 'mouse-trap-mode minor-mode-map-alist))))) + (should (assq 'mouse-trap-mode mouse-trap--emulation-alist))))) (ert-deftest test-integration-lighter-click-disables-mode () "Test clicking lighter when mode is enabled disables it and removes keymap." @@ -43,7 +43,7 @@ Dashboard uses scroll+primary profile which allows scrolling and mouse-1." (emacs-lisp-mode) (mouse-trap-mode 1) (should mouse-trap-mode) - (should (assq 'mouse-trap-mode minor-mode-map-alist)) + (should (assq 'mouse-trap-mode mouse-trap--emulation-alist)) ;; Simulate clicking lighter to disable (mouse-trap-mode -1) @@ -52,7 +52,7 @@ Dashboard uses scroll+primary profile which allows scrolling and mouse-1." (should-not mouse-trap-mode) ;; Keymap should be removed from minor-mode-map-alist - (should-not (assq 'mouse-trap-mode minor-mode-map-alist)))) + (should-not (assq 'mouse-trap-mode mouse-trap--emulation-alist)))) (ert-deftest test-integration-lighter-click-toggle-updates-keymap () "Test toggling mode via lighter click rebuilds keymap for current mode. @@ -142,12 +142,12 @@ Auto-enable is blocked, but manual toggle should still work." ;; But manual toggle should work (mouse-trap-mode 1) (should mouse-trap-mode) - (should (assq 'mouse-trap-mode minor-mode-map-alist)) + (should (assq 'mouse-trap-mode mouse-trap--emulation-alist)) ;; Toggle off (mouse-trap-mode -1) (should-not mouse-trap-mode) - (should-not (assq 'mouse-trap-mode minor-mode-map-alist)))) + (should-not (assq 'mouse-trap-mode mouse-trap--emulation-alist)))) (ert-deftest test-integration-lighter-click-multiple-rapid-toggles () "Test rapid clicking (multiple toggles) is stable and doesn't corrupt state." @@ -162,12 +162,12 @@ Auto-enable is blocked, but manual toggle should still work." ;; Should end in disabled state (even number of toggles) (should-not mouse-trap-mode) - (should-not (assq 'mouse-trap-mode minor-mode-map-alist)) + (should-not (assq 'mouse-trap-mode mouse-trap--emulation-alist)) ;; Enable one more time to end enabled (mouse-trap-mode 1) (should mouse-trap-mode) - (should (assq 'mouse-trap-mode minor-mode-map-alist)) + (should (assq 'mouse-trap-mode mouse-trap--emulation-alist)) (should (keymapp mouse-trap-mode-map)))) (provide 'test-integration-mousetrap-mode-lighter-click) |
