-
Notifications
You must be signed in to change notification settings - Fork 668
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
wrapper.setProps doesn't work on Functional component #402
Comments
There isn't any data in a functional component, so you calling But there is an issue with |
MessageToggle.vue has a data object - I'm not sure I understand what you mean. Please can you explain? |
You're calling If the tests were previously working correctly with setData, it was because setData was behaving incorrectly. |
Thanks & my bad, I thought I was testing MessageToggle but actually it was just the Message component that wrote the spec for. I'm going to have to double check my original failing setData tests then 😕 |
@eddyerburgh if setProps and setData not working. How set props on functional component? |
In what state is this? |
It's not being worked on. I think we need a change in core to be able to implement this. I believe we need to have access to the render context, but it's not exposed—https://github.com/vuejs/vue/blob/dev/src/core/vdom/create-functional-component.js#L97. If you want to look into this, I'd be happy to help. |
@dimensi you can mount it via |
Guys, help. I tried with shallowMount and mount
But i tried a another approach.
|
No this is intended behavior, |
Looks like the mentioned PR was merged, can we do something about |
Yes, although it's fairly low on my priority list. I'll try to get it done within a month, but if somebody else would like to work on it I'd be happy to review the PR and give pointers on how to do it. |
I will like to work on it @eddyerburgh. Can you give me pointers please |
Ping! |
At the time this seems like a good idea, however reflecting on it For your functional component tests, make assertions on the DOM instead of using |
@lmiller1990 thanks for the advice, but I am still not possible to use basic DOM for functional component that accepts binded objects, for example: <fieldset class="fieldset" is="ColaboMaterial" type="fieldset" :info="{test: "hello"}">
<select is="ColaboMaterial" type="autocomplete" class="node-select" v-model="autocompleteCustomTemplateValue" :info="{ options: getAutocompleteCustomTemplateOptions, placeholder: 'Chose {{ schemaName }}' }">
<button class="button-select-target-node" is="ColaboMaterial" type="button" :info="{ primary: false, raised: true }" @click="selectTargetNode()">Select</button> For all 3 of them if I access the Is there any workaround to test bound (object) props for functional components |
I don't understand what passing an |
Version
1.0.0-beta.11
Reproduction link
https://github.com/jonnyparris/vue-test-utils-mocha-webpack-example/blob/e2e634e4640ce40180b957b4feab51076b77a780/test/Message.spec.js#L19
Steps to reproduce
use setData() as per docs
What is expected?
data should be set
What is actually happening?
data remains unchanged
Bug seems to have been introduced somewhere between version beta3 and beta11 (only just upgraded packages across my project)
The text was updated successfully, but these errors were encountered: