-
Notifications
You must be signed in to change notification settings - Fork 665
Closed
Labels
Description
Version
1.0.0-beta.20
Reproduction link
Steps to reproduce
Add this to test/specs/wrapper/setData.spec.js
it('should append a new property to an object when the new property is referenced by a template', () => {
const TestComponent = {
data: () => ({
anObject: {
propA: 'a',
propB: 'b'
}
}),
computed: {
anObjectKeys() {
return Object.keys(this.anObject).join(',')
}
},
template: `<div>{{ anObjectKeys }}</div>`
}
const wrapper = mountingMethod(TestComponent)
wrapper.setData({
anObject: {
propC: 'c'
}
})
expect(wrapper.vm.anObject.propA).to.equal('a')
expect(wrapper.vm.anObject.propB).to.equal('b')
expect(wrapper.vm.anObject.propC).to.equal('c')
expect(wrapper.vm.anObjectKeys).to.equal('propA,propB,propC')
expect(wrapper.html()).to.equal('<div>propA,propB,propC</div>')
})
What is expected?
expect(wrapper.vm.anObjectKeys).to.equal('propA,propB,propC')
What is actually happening?
The computed property is not being updated, when setData()
is being called.
If you remove the reference to anObjectKeys
from the template, it works fine - besides the last assertion, obviously.
Also fails in dev @ 1ee03ac
See also, #565
aphofstede, lauraluiz and eddyerburgh