Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Functional Component Not Receiving Prop Data #1490

Closed
mlturner88 opened this issue May 10, 2022 · 3 comments · Fixed by #1513
Closed

Bug: Functional Component Not Receiving Prop Data #1490

mlturner88 opened this issue May 10, 2022 · 3 comments · Fixed by #1513
Labels
bug Something isn't working

Comments

@mlturner88
Copy link

Describe the bug
Initial or later set props are not being passed into a functional component.

To Reproduce
I have made a sample repo showcasing the issue here. After cloning the repo you may use the below commands to run the tests.

npm install
npm run test

Expected behavior
Functional components to receive props from the mount() function.

Related information:

  • @vue/test-utils version: 2.0.0-rc.21
  • Vue version: 3.2.33
  • node version: 16.15.0
  • npm version: 8.5.5

Additional context
The example (and my project itself) are using vite and vitest in conjunction with @vue/test-utils.

@mlturner88 mlturner88 added the bug Something isn't working label May 10, 2022
@freakzlike
Copy link
Collaborator

@mlturner88
Copy link
Author

You need to await setProps

https://test-utils.vuejs.org/guide/essentials/passing-data.html#using-setprops

What about the case of mounting the component giving it props from the start?

freakzlike added a commit to freakzlike/test-utils that referenced this issue May 19, 2022
@freakzlike
Copy link
Collaborator

Oh sorry, I missed that. I was able to reproduce it in our unit tests and pushed a fix #1513

lmiller1990 pushed a commit that referenced this issue May 20, 2022
* chore: Add regression tests for #1490

* fix: Pass props to functional component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants