test(Collapsible): add keyboard toggle tests for non-native activator elements#641
Open
sridhar-3009 wants to merge 2 commits into
Open
Conversation
Contributor
|
✅ Changeset found — this change will be included in the next release. Thanks! |
Member
|
This PR currently has merge conflicts with its base branch ( Context: we're adopting a git-flow branch model — |
… elements CollapsibleActivator correctly implements onKeydown for Enter/Space and sets role=button when as is not 'button'. The 'non-button activator' describe block already covers role=button/tag/no-type-attribute and a click-based toggle, but nothing verified that a non-native activator actually toggles on Enter/Space — only the default button activator had keyboard coverage. Add two tests to the existing 'non-button activator' block, matching the style already used by the 'open via keyboard' block: mount with activatorAs: 'div', trigger a real keydown event on the role=button element, and assert the content unhides. Rebased onto master's post-vuetifyjs#655 test layout: index.test.ts was consolidated into index.browser.test.ts as part of the 1.0 promotion, and the test style moved from capturing render-prop handlers to triggering real DOM events via @vue/test-utils. Rewrote both new tests in that style rather than reintroducing the old render-prop pattern.
sridhar-3009
force-pushed
the
test/collapsible-non-native-keyboard-toggle
branch
from
July 24, 2026 15:50
c256024 to
9d0a051
Compare
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
CollapsibleActivatorcorrectly handles Enter/Space inonKeydownand setsrole='button'for non-native elements, but every existing keyboard test uses the defaultas='button'elementnon-button activatordescribe block already coversrole='button'/tag/no-type-attribute and a click-based toggle, but nothing verified that a non-native activator actually toggles on Enter/SpaceactivatorAs: 'div': Enter opens, Space opensWhat changed
index.browser.test.ts: two new tests in the existingnon-button activatorblock, matching the style already used by theopen via keyboardblock — a realkeydownDOM event via@vue/test-utils, not a captured render-prop handlerRebase note
Rebased onto master's post-#655 test layout:
index.test.tswas consolidated intoindex.browser.test.tsas part of the 1.0 component-spine promotion, and the test style moved from capturing render-prop handlers to triggering real DOM events. Rewrote both new tests in that style rather than reintroducing the old pattern — therole='button'coverage I originally added is no longer needed since it already exists on master (should expose role=button and no native type when rendered as a div).Test plan
activatorAs: 'div'toggles collapsible openactivatorAs: 'div'toggles collapsible openpnpm test:run --project v0:browser)