-
Notifications
You must be signed in to change notification settings - Fork 257
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: The wrapper methods props can't get specific prop in functional component #1311
Comments
Hmm, interesting. I guess not a lot of people are using functional components in Vue 3 and we never caught this. Would you like to try to fix it? You can start by adding a test in Then the relevant code is here: Lines 126 to 131 in 67a3e7a
We probably need some special handling for functional components. |
woot 😄 . i find the problem is the functional component wrapper ignored the props options. Lines 281 to 301 in 67a3e7a
I have an idea is add instance methods name const wrapper = mount(xx,{
props: {
"title":"h1"
}
});
wrapper.attrs('title') === "h1" |
* feat(props): add test for functional component * feat(props): compatible functional component props #1311 * feat(props): compatible functional component props #1311 * fix: lint code style Co-authored-by: evanzyli <[email protected]>
Fixed by #1326 |
Describe the bug
The wrapper methods props can't get specific prop in functional component
To Reproduce
const wrapper = mount(Component,{
props: {
title: 'title'
}
});
expect(wrapper.props('title')).toContain('title') // not pass , the wrapper.props('title') is undeinfed
Expected behavior
Related information:
@vue/test-utils
version: ^2.0.0-rc.17Vue
version: 3.2.27node
version: v16.0.0npm
(oryarn
) version: v8.3.0Additional context
The text was updated successfully, but these errors were encountered: