test(hotkey): add coverage for alternate (/) key combinations#22716
Open
mixelburg wants to merge 1 commit intovuetifyjs:masterfrom
Open
test(hotkey): add coverage for alternate (/) key combinations#22716mixelburg wants to merge 1 commit intovuetifyjs:masterfrom
mixelburg wants to merge 1 commit intovuetifyjs:masterfrom
Conversation
The useHotkey composable supports the '/' syntax for alternate key combinations (e.g. 'up/down' fires for either ArrowUp or ArrowDown), but the test suite had zero coverage for this case. This was reported in issue vuetifyjs#22712, where pressing the first key in an alternate combination ('1' in '1/2') did not trigger the callback while pressing the last one ('2') did. Add tests that: - verify every alternative in a combo independently fires the callback - confirm unrelated keys are ignored - ensure alternates work inside a longer sequence ('a/b-c') Refs: vuetifyjs#22712
Contributor
|
I don't think the code is so brittle it needs 2 middle test cases. The 1st and the 4th feel enough. |
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.
Summary
Closes #22712
The
useHotkeycomposable parses the/character as an alternate separator (e.g.'up/down'means "fire on ArrowUp or ArrowDown"), yet the test suite had zero coverage for this code path.What was reported
In #22712, a user found that pressing the first key of an alternate combination (
'1'in'1/2') did not trigger the callback, while pressing the last key ('2') did work.What these tests cover
'1/2'→ '1' fires;'1/2'→ '2' fires'up/down'→ ArrowUp and ArrowDown each fire'ctrl+a/ctrl+b'fires for each combo'shift+tab/tab'fires for both shifted and unshifted Tab'a/b'does nothing'a/b-c'means (a OR b), then c — tests both entry pointsIf the alternate matching logic is broken for the first element (as #22712 describes), the
'1/2' → '1'and similar tests will surface the regression.