test(dual-tap): cover handleDualTap; document Shift gesture in layout spec#169
Open
dormouse-bot wants to merge 1 commit into
Open
test(dual-tap): cover handleDualTap; document Shift gesture in layout spec#169dormouse-bot wants to merge 1 commit into
dormouse-bot wants to merge 1 commit into
Conversation
… spec handleDualTap had no test coverage despite non-trivial timing/state-machine logic (500ms window, left→right ordering, independent Meta/Shift tracks, and the always-consume contract). Add handle-dual-tap.test.ts pinning that behavior. The Shift dual-tap variant was also undocumented in docs/specs/layout.md (only the Meta LCmd→RCmd gesture was described). Update the passthrough and "Enter command mode" sections to match the code. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Deploying mouseterm with
|
| Latest commit: |
c7d66f5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://7d15d23b.mouseterm.pages.dev |
| Branch Preview URL: | https://test-dual-tap-coverage.mouseterm.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Surfaced by the nightly code-quality survey.
handleDualTap(handle-dual-tap.ts) is the mode-exit gesture detector: a left-then-right tap of Meta (or Shift) within 500ms exits passthrough mode. It carries non-trivial state-machine logic — a per-side timing window, strict left→right ordering, two independent Meta/Shift tracks, and an "always consume Meta/Shift presses" contract that the doc comment explicitly flags as a correctness requirement ("so later handlers don't misinterpret a modifier release as a navigation key"). None of it was covered by a test.This PR adds
handle-dual-tap.test.tspinning that behavior:false(not consumed); Meta/Shift returntrueexitTerminalModeWhile writing the tests I noticed the Shift gesture is undocumented in the layout spec —
docs/specs/layout.mddescribed only theLCmd → RCmdMeta gesture for both the passthrough mode-exit and "Enter command mode" sections. Per AGENTS.md ("When updating code covered by a spec, update the spec to match"), this PR also updates those two sections to document theLShift → RShiftvariant and note that the Meta and Shift tracks are independent.No behavior change — tests and docs only.