diff --git a/packages/test-utils/src/wrapper.js b/packages/test-utils/src/wrapper.js index 8091ea04b..737bd21d5 100644 --- a/packages/test-utils/src/wrapper.js +++ b/packages/test-utils/src/wrapper.js @@ -664,7 +664,8 @@ export default class Wrapper implements BaseWrapper { this.vm.$options.propsData[key] = data[key] } }) - + // $FlowIgnore : Problem with possibly null this.vm + this.vm.$forceUpdate() // $FlowIgnore : Problem with possibly null this.vm orderWatchers(this.vm || this.vnode.context.$root) Vue.config.silent = originalConfig diff --git a/test/specs/wrapper/setProps.spec.js b/test/specs/wrapper/setProps.spec.js index 7e5852c83..a275f1ab7 100644 --- a/test/specs/wrapper/setProps.spec.js +++ b/test/specs/wrapper/setProps.spec.js @@ -24,6 +24,20 @@ describeWithShallowAndMount('setProps', mountingMethod => { expect(wrapper.find('.prop-2').element.textContent).to.equal(prop2) }) + it('sets props and updates when called with same object', () => { + const TestComponent = { + template: '
', + props: ['obj'] + } + const obj = { + shouldRender: () => false + } + const wrapper = mountingMethod(TestComponent) + obj.shouldRender = () => true + wrapper.setProps({ obj }) + expect(wrapper.is('div')).to.equal(true) + }) + it('throws error if component does not include props key', () => { const TestComponent = { template: ''