chore: use fresh containers for app mount tests

This commit is contained in:
Evan You 2024-08-08 14:42:07 +08:00
parent 1ef8f46af0
commit 7d5743223f
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A
1 changed files with 4 additions and 1 deletions

View File

@ -104,6 +104,8 @@ describe('defineCustomElement', () => {
}, },
}) })
const app = createApp(containerComp) const app = createApp(containerComp)
const container = document.createElement('div')
document.body.appendChild(container)
app.mount(container) app.mount(container)
const myInputEl = container.querySelector('my-el-input')! const myInputEl = container.querySelector('my-el-input')!
const inputEl = myInputEl.shadowRoot!.querySelector('input')! const inputEl = myInputEl.shadowRoot!.querySelector('input')!
@ -115,7 +117,6 @@ describe('defineCustomElement', () => {
myInputEl.removeAttribute('value') myInputEl.removeAttribute('value')
await nextTick() await nextTick()
expect(inputEl.value).toBe('') expect(inputEl.value).toBe('')
app.unmount()
}) })
test('should not unmount on move', async () => { test('should not unmount on move', async () => {
@ -1188,6 +1189,8 @@ describe('defineCustomElement', () => {
}, },
}), }),
) )
const container = document.createElement('div')
document.body.appendChild(container)
createApp({ createApp({
render() { render() {
return h('div', [ return h('div', [