-
Notifications
You must be signed in to change notification settings - Fork 259
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: data callback on mount/shallowmount does not work for composition / class component #1879
Comments
Hi @AWoelfel This is expected (and mentioned in the docs, see https://test-utils.vuejs.org/api/#setdata) If you want to update the internal state of a script setup component, you can use |
Hi @cexbrayat Besides my problems i found #1058 ; wrote a fix and, to this second, prepare a PR to support both I do not like to use Thanks in advance! Alex |
setData is still in VTU v2 for components written with the options API. Note that It would look strange to me to use |
Thx! On my side, i primarly like to mount/shallowmount a component with a predefined state on the data properties. I was not aware of the fact edit: I am aware that the component propagates all events with Alex |
Describe the bug
i use
<script setup/>
composite component api and want to use thedata : () => Record<string, unknown>
callback in mount/shallowmountTo Reproduce
following test fails if used with the component below
Component
SimpleData.vue
while this test (using an inline declaration will not fail)
Expected behavior
both tests should not fail
Related information:
@vue/test-utils
version: 2.2.4Vue
version: 3.2.33node
version: 16.18.0npm
version: 8.19.2The text was updated successfully, but these errors were encountered: