diff --git a/test/resources/components/component-with-computed-created.vue b/test/resources/components/component-with-computed-created.vue new file mode 100644 index 000000000..6dc17b9cc --- /dev/null +++ b/test/resources/components/component-with-computed-created.vue @@ -0,0 +1,15 @@ + + diff --git a/test/specs/wrapper/setProps.spec.js b/test/specs/wrapper/setProps.spec.js index fee329a4a..ea3f360f6 100644 --- a/test/specs/wrapper/setProps.spec.js +++ b/test/specs/wrapper/setProps.spec.js @@ -1,6 +1,7 @@ import { compileToFunctions } from 'vue-template-compiler' import ComponentWithProps from '~resources/components/component-with-props.vue' import ComponentWithWatch from '~resources/components/component-with-watch.vue' +import ComponentWithComputedCreated from '~resources/components/component-with-computed-created.vue' import { describeWithShallowAndMount, vueVersion } from '~resources/utils' describeWithShallowAndMount('setProps', mountingMethod => { @@ -90,6 +91,12 @@ describeWithShallowAndMount('setProps', mountingMethod => { expect(wrapper.find('.prop-2').element.textContent).to.equal(prop2) }) + it('sets component prop referenced through computed and created', () => { + const wrapper = mountingMethod(ComponentWithComputedCreated, {propsData: {prop1: 1}}) + wrapper.setProps({prop1: 2}) + expect(wrapper.vm.prop1).to.equal(2) + }) + it('runs watch function when prop is updated', () => { const wrapper = mountingMethod(ComponentWithWatch) const prop1 = 'testest'