Skip to content

Conversation

@n-rowe
Copy link
Contributor

@n-rowe n-rowe commented Feb 21, 2025

πŸ”— Linked issue

Resolved #572

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

With the change to resolve #572 the internal emit function for the component was changed to use the root component so that emits can be picked up by vitest.

This had the side-effect of breaking user-passed event listeners as props to the component:

const component = await mountSuspended(MyComponent, {
  props: {
    'onUpdate:modelValue': async e => component.setProps({ modelValue: e }),
  },
})

To resolve this I changed the internal component emit to call both the original emit and the root component emit.
I've also added a new unit test for this case.

@n-rowe n-rowe requested a review from danielroe as a code owner February 21, 2025 11:11
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 21, 2025

Open in Stackblitz

npm i https://pkg.pr.new/@nuxt/test-utils@1135

commit: 55d0dd6

@danielroe
Copy link
Member

thank you!

@danielroe danielroe merged commit 0aeac8e into nuxt:main Feb 21, 2025
6 checks passed
@github-actions github-actions bot mentioned this pull request Feb 21, 2025
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.

Emitted events doesn't work with defineModel

2 participants