Skip to content

Commit

Permalink
Reproduction for vuejs#2035
Browse files Browse the repository at this point in the history
  • Loading branch information
freakzlike committed May 19, 2023
1 parent e742510 commit 2d431d8
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion tests/shallowMount.spec.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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: '<div />'
})

const wrapper = mount(
defineComponent({
components: { TestComp },
template: '<TestComp prefix="foo" />'
}),
{ shallow: true }
)
expect(wrapper.html()).toBe(
'<test-comp-stub prefix="foo"></test-comp-stub>'
)

expect(wrapper.findComponent(TestComp).props('prefix')).toBe('foo')

expect(spyWarn).not.toHaveBeenCalled()
spyWarn.mockRestore()
})
})

0 comments on commit 2d431d8

Please sign in to comment.