Skip to content

Commit

Permalink
test: update test case for vuejs#11871
Browse files Browse the repository at this point in the history
  • Loading branch information
edison1105 committed Sep 11, 2024
1 parent 50dd486 commit 207e122
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/runtime-dom/__tests__/customElement.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
h,
inject,
nextTick,
onMounted,
provide,
ref,
render,
Expand Down Expand Up @@ -978,8 +979,16 @@ describe('defineCustomElement', () => {
})

test('render nested customElement w/ shadowRoot false', async () => {
const calls: string[] = []

const Child = defineCustomElement(
{
setup() {
calls.push('child rending')
onMounted(() => {
calls.push('child mounted')
})
},
render() {
return renderSlot(this.$slots, 'default')
},
Expand All @@ -990,6 +999,12 @@ describe('defineCustomElement', () => {

const Parent = defineCustomElement(
{
setup() {
calls.push('parent rending')
onMounted(() => {
calls.push('parent mounted')
})
},
render() {
return renderSlot(this.$slots, 'default')
},
Expand All @@ -1016,6 +1031,12 @@ describe('defineCustomElement', () => {
expect(e.innerHTML).toBe(
`<my-child data-v-app=""><span>default</span></my-child>`,
)
expect(calls).toEqual([
'parent rending',
'parent mounted',
'child rending',
'child mounted',
])
app.unmount()
})

Expand Down

0 comments on commit 207e122

Please sign in to comment.