Skip to content

Commit 24964da

Browse files
committed
test: test case for #6966
1 parent 67890da commit 24964da

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/runtime-dom/__tests__/customElement.spec.ts

+12
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ describe('defineCustomElement', () => {
7272
expect(e._instance).toBe(i)
7373
expect(e.shadowRoot!.innerHTML).toBe('<div>hello</div>')
7474
})
75+
76+
test('remove then insert again', async () => {
77+
container.innerHTML = `<my-element></my-element>`
78+
const e = container.childNodes[0] as VueElement
79+
container.removeChild(e)
80+
await nextTick()
81+
expect(e._instance).toBe(null)
82+
expect(e.shadowRoot!.innerHTML).toBe('')
83+
container.appendChild(e)
84+
expect(e._instance).toBeTruthy()
85+
expect(e.shadowRoot!.innerHTML).toBe('<div>hello</div>')
86+
})
7587
})
7688

7789
describe('props', () => {

0 commit comments

Comments
 (0)