test(card): improve test coverage#1989
Open
aioya wants to merge 1 commit into
Open
Conversation
|
@aioya is attempting to deploy a commit to the varletjs Team on Vercel. A member of the Team first needs to authorize it. |
@varlet/cli
@varlet/icons
@varlet/import-resolver
@varlet/preset-tailwindcss
@varlet/preset-unocss
@varlet/shared
@varlet/touch-emulator
@varlet/ui
@varlet/use
@varlet/vite-plugins
commit: |
There was a problem hiding this comment.
Pull request overview
Improves unit test coverage for the Card component, with added assertions around floating/dropdown layout behavior, close-button updates, and ripple-related behavior (tests only; no runtime component changes).
Changes:
- Added an events test to verify the floating close button triggers
onUpdate:floating(false). - Added props/layout tests for floating dropdown layout restoration and row-layout behavior.
- Added ripple-related tests, including a check for the floating ripple delay and ripple-disabled behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+53
to
+67
| test('card floating respects ripple delay', async () => { | ||
| const timerSpy = vi.spyOn(global, 'setTimeout') | ||
| const wrapper = mount(VarCard, { | ||
| props: { | ||
| floating: true, | ||
| ripple: true, | ||
| }, | ||
| }) | ||
|
|
||
| await delay(16) | ||
| expect(timerSpy.mock.calls.some(([, delay]) => delay === 500)).toBe(true) | ||
| await delay(550) | ||
| wrapper.unmount() | ||
| timerSpy.mockRestore() | ||
| }) |
Comment on lines
+411
to
+413
| await wrapper.trigger('touchstart') | ||
| await delay(50) | ||
| expect(wrapper.find('.var-ripple').exists()).toBe(false) |
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.
Checklist
List of tasks you have already done and plan to do.
Change information
Improve unit test coverage for the card component, including the floating dropdown layout behavior. Pure test additions, no behavior changes.
Issues
N/A
Related Links
N/A