[Test Improver] Add unit tests for useDrawer composable - #105
Draft
github-actions[bot] wants to merge 1 commit into
Draft
[Test Improver] Add unit tests for useDrawer composable#105github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
7 unit tests covering the open() and close() functions
of the useDrawer composable:
- open() without options: correct payload shape
- open() with extra options: options merged into componentProps
- open() always sets triggerFocusTrap=true regardless of options
- open() returnFocusSelector argument always wins over options
- open() with empty {} same as no options
- close() commits 'slideInPanel/close'
- close() passes no additional payload
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Jun 29, 2026
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.
🤖 This PR was created by Test Improver, an automated AI assistant focused on improving test coverage.
Goal and Rationale
shell/composables/drawer.ts(theuseDrawercomposable) had no test coverage. It wrapsslideInPanelVuex store commits with a typed API for opening/closing drawer panels, and has non-trivial invariant behavior worth validating:open()always setstriggerFocusTrap: trueregardless of what the caller passes inoptionsopen()always uses thereturnFocusSelectorargument, even ifoptionsincludes a conflicting valueThese properties are important for accessibility (focus trap) and focus-return correctness.
Approach
vuex.useStoreto return a spycommitfunctionuseDrawer()directly (no Vue lifecycle hooks to trigger)toHaveBeenCalledWithwith exact payload shapes for strong assertionstriggerFocusTrapinvariant,returnFocusSelectorinvariant, empty options, close behaviour, and payload arityCoverage Impact
shell/composables/drawer.tsTest Status
Reproducibility
Warning
Firewall blocked 1 domain
The following domain was blocked by the firewall during workflow execution:
download.cypress.ioSee Network Configuration for more information.