From 2d431d815d467799a1b1c2da9c64d66c7a587ede Mon Sep 17 00:00:00 2001 From: freakzlike Date: Fri, 19 May 2023 09:45:56 +0200 Subject: [PATCH] Reproduction for #2035 --- tests/shallowMount.spec.ts | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/shallowMount.spec.ts b/tests/shallowMount.spec.ts index 21209f04e..fbfac17a4 100644 --- a/tests/shallowMount.spec.ts +++ b/tests/shallowMount.spec.ts @@ -1,4 +1,4 @@ -import { describe, expect, it } from 'vitest' +import { describe, expect, it, vi } from 'vitest' import { defineAsyncComponent, defineComponent } from 'vue' import { mount, shallowMount, VueWrapper } from '../src' import ComponentWithChildren from './components/ComponentWithChildren.vue' @@ -226,4 +226,32 @@ describe('shallowMount', () => { expect(wrapper.find('computed-property-stub').exists()).toBe(false) }) + + it('should set prop that is shared with Element', async () => { + const spyWarn = vi.spyOn(console, 'warn') + + const TestComp = defineComponent({ + props: { + // https://developer.mozilla.org/en-US/docs/Web/API/Element/prefix + prefix: String + }, + template: '
' + }) + + const wrapper = mount( + defineComponent({ + components: { TestComp }, + template: '' + }), + { shallow: true } + ) + expect(wrapper.html()).toBe( + '' + ) + + expect(wrapper.findComponent(TestComp).props('prefix')).toBe('foo') + + expect(spyWarn).not.toHaveBeenCalled() + spyWarn.mockRestore() + }) })