I actually still have some issues where one watcher should update another field. Version 1.0.0-beta.9.
props: {
name: String,
},
data: {
fullname: ''
},
watch: {
name(val) {
this.fullname = val + ' surname';
},
}
...
...
wrapper.setProps({
name: 'new name'
})
wrapper.vm.fullname = 'old name surname';
// however, after calling wrapper.update() it got updated, but not rerendered. And again, after second wrapper.update() it is rendered. I have transition-group element in my code, but it is stubbed
I think the problem is that in the current implementation, watchers are run after the _render() call:
https://github.com/vuejs/vue-test-utils/commit/e4151b00ed72da134b8e6f38239824c87c715ce3#diff-dbfd1670fb2dd50be051adb6643c8c24R18
Usually all watchers would run before the component re-renders.
@vladferix can you post a full reproduction? I'm unable to reproduce using the code you posted
@eddyerburgh okay, here it is
vue-test-utils-bug.zip
Most helpful comment
This is fixed in https://github.com/vuejs/vue-test-utils/commit/c095221a3a05595a4f49aaeda5e7d2e888b9e092