Skip to content

test(card): improve test coverage#1989

Open
aioya wants to merge 1 commit into
varletjs:devfrom
aioya:test/card-coverage
Open

test(card): improve test coverage#1989
aioya wants to merge 1 commit into
varletjs:devfrom
aioya:test/card-coverage

Conversation

@aioya

@aioya aioya commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Checklist

List of tasks you have already done and plan to do.

  • Fix linting errors
  • Tests have been added / updated (or snapshots)

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

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

@aioya is attempting to deploy a commit to the varletjs Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new

pkg-pr-new Bot commented Jun 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@varlet/cli

npm i https://pkg.pr.new/@varlet/cli@1989

@varlet/icons

npm i https://pkg.pr.new/@varlet/icons@1989

@varlet/import-resolver

npm i https://pkg.pr.new/@varlet/import-resolver@1989

@varlet/preset-tailwindcss

npm i https://pkg.pr.new/@varlet/preset-tailwindcss@1989

@varlet/preset-unocss

npm i https://pkg.pr.new/@varlet/preset-unocss@1989

@varlet/shared

npm i https://pkg.pr.new/@varlet/shared@1989

@varlet/touch-emulator

npm i https://pkg.pr.new/@varlet/touch-emulator@1989

@varlet/ui

npm i https://pkg.pr.new/@varlet/ui@1989

@varlet/use

npm i https://pkg.pr.new/@varlet/use@1989

@varlet/vite-plugins

npm i https://pkg.pr.new/@varlet/vite-plugins@1989

commit: e3392da

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants