-
Notifications
You must be signed in to change notification settings - Fork 669
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
Watch with immediate totally breaks setProps #1419
Watch with immediate totally breaks setProps #1419
Comments
There is a test for this usecase, well almost
But if u do add watch in mounted -> it works. |
Hey, thanks for the report. This is definitely a bug. What is your use case for this? There might be a better way than Are you able to share your use case? Happy to provide some alternatives to BTW thanks for your work on Nuxt.js, it is awesome, I love it. |
Well, the usecase pretty simple and general. Test components with different props passed to it. Its not specific to watch in any way. Thanks for your work on test utils too :) |
I think this is ok - then you don't need to
Kind of - Oddly enough, this passes: it('with imeddiate', async () => {
component.setProps({
test: 'second'
})
await localVue.nextTick()
component.setProps({
test: 'second'
})
await localVue.nextTick()
expect(component.vm.test).toBe('second')
}) I think the problem is if It is likely we will be revisiting |
I'll second what was said. User input may not be in the component I'm testing, but the result of it may cause the props being passed into my component to update. So testing that the component appropriately responds to changing props is a very valid use case in my opinion, and one that we test a decent amount. |
Yep, As for this bug, I did not get time to investigate it yet. If you would like to do so, I can probably give you some pointers as to where to start? |
setProps in certain cases was being blown away by nextTick intervals. If the property is not up to date, setProps will be called again to sync the changes. fix vuejs#1419
@lmiller1990 @aldarund I took a stab at this just as an idea. Maybe this is a terrible idea, but figured we can return a promise wrapping https://github.com/vuejs/vue-test-utils/pull/1618/files |
setProps in certain cases was being blown away by nextTick intervals. If the property is not up to date, setProps will be called again to sync the changes. fix vuejs#1419
setProps in certain cases was being blown away by nextTick intervals. If the property is not up to date, setProps will be called again to sync the changes. fix vuejs#1419
…als (#1618) * fix(setprops): allowed for setProps to be synced with nextTick intervals setProps in certain cases was being blown away by nextTick intervals. If the property is not up to date, setProps will be called again to sync the changes. fix #1419 * Update packages/test-utils/src/wrapper.js Co-authored-by: Bill Glesias <[email protected]> Co-authored-by: Lachlan <[email protected]>
Hello, I'm new to Vue and to Vue testing. I'm trying to follow along with your Vue School classes; I even paid to join. But, nothing works the way your classes state it's supposed to. Right now, I'm trying to follow along with the class/video for testing computed and watched properties, which states to use setProps() to change the property for a temperature. It doesn't work at all. The property is not changed. ( setData() didn't work the same way your VueSchool states either, but I edited the test enough to get it to work.) I don't really follow much of this thread, being new to Vue. But, in the forked repo for the class, the watched property's immediate is set to true. How do I make this work so I can at least continue learning with your Vue classes? Here is my forked copy of your repo: https://github.com/hcunninghampk/testing-vue-components. I'm on the 2nd branch. PS -- How much your Vue School instructions differ from the ways methods, functions, etc. have been updated and deprecated is extremely, extremely frustrating. If one is new to Vue, how are we supposed to figure out how to make these classes/videos work, when the classes/videos are not updated -- especially for classes/videos I paid for. Will you please update your classes/videos so they work? |
… not work the way Vue states it should. Has an open bug: vuejs/vue-test-utils#1419 * Commented out test. Skipping does not work well with output
Version
1.0.0-beta.31
Reproduction link
https://github.com/aldarund/vue-test-utils-transition-bug/blob/master/components/watch.test.js
https://github.com/aldarund/vue-test-utils-transition-bug/blob/master/components/watchtest.vue
Steps to reproduce
use watch with immediate as prop
What is expected?
both test run succesfully
What is actually happening?
setProps when there is watch with immediate in component dont do anything, it just dont set prop at all.
The text was updated successfully, but these errors were encountered: