Skip to content

Commit 2d431d8

Browse files
committed
Reproduction for #2035
1 parent e742510 commit 2d431d8

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

tests/shallowMount.spec.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, expect, it } from 'vitest'
1+
import { describe, expect, it, vi } from 'vitest'
22
import { defineAsyncComponent, defineComponent } from 'vue'
33
import { mount, shallowMount, VueWrapper } from '../src'
44
import ComponentWithChildren from './components/ComponentWithChildren.vue'
@@ -226,4 +226,32 @@ describe('shallowMount', () => {
226226

227227
expect(wrapper.find('computed-property-stub').exists()).toBe(false)
228228
})
229+
230+
it('should set prop that is shared with Element', async () => {
231+
const spyWarn = vi.spyOn(console, 'warn')
232+
233+
const TestComp = defineComponent({
234+
props: {
235+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/prefix
236+
prefix: String
237+
},
238+
template: '<div />'
239+
})
240+
241+
const wrapper = mount(
242+
defineComponent({
243+
components: { TestComp },
244+
template: '<TestComp prefix="foo" />'
245+
}),
246+
{ shallow: true }
247+
)
248+
expect(wrapper.html()).toBe(
249+
'<test-comp-stub prefix="foo"></test-comp-stub>'
250+
)
251+
252+
expect(wrapper.findComponent(TestComp).props('prefix')).toBe('foo')
253+
254+
expect(spyWarn).not.toHaveBeenCalled()
255+
spyWarn.mockRestore()
256+
})
229257
})

0 commit comments

Comments
 (0)