diff --git a/tests/setValue.spec.ts b/tests/setValue.spec.ts index 911a039b4..5c0a4c536 100644 --- a/tests/setValue.spec.ts +++ b/tests/setValue.spec.ts @@ -295,17 +295,30 @@ describe('setValue', () => { template: '
{{ foo }} {{ bar }}
' }) + const NestedInputComponentChild = defineComponent({ + props: ['modelValue', 'onUpdate:modelValue'], + template: '
{{ modelValue }}
' + }) + const NestedInputComponent = defineComponent({ + props: ['modelValue', 'onUpdate:modelValue'], + template: '', + components: { NestedInputComponentChild } + }) + const Component = defineComponent({ template: - '', + ` + + `, data() { return { plain: null, foo: null, - bar: null + bar: null, + nested: null } }, - components: { PlainInputComponent, MultiInputComponent } + components: { PlainInputComponent, MultiInputComponent, NestedInputComponent } }) describe('mount', () => { @@ -324,6 +337,14 @@ describe('setValue', () => { expect(multiInput.text()).toContain('fooValue') expect(multiInput.text()).toContain('barValue') }) + + it('triggers a normal `v-model` on nested Vue Components', async () => { + const wrapper = mount(Component) + const nested = wrapper.findComponent(NestedInputComponent) + const child = nested.findComponent(NestedInputComponentChild) + await child.setValue('nested-value') + expect(nested.text()).toContain('nested-value') + }) }) describe('shallowMount', () => { it('triggers a normal `v-model` on a Vue Component', async () => {