fix(runtime-core): avoid mutating EMPTY_ARR when setting dev root (#2419)
also freeze EMPTY_ARR in dev fix #2413
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { EMPTY_ARR } from '@vue/shared'
|
||||
import { createApp, ref, nextTick, reactive } from '../src'
|
||||
|
||||
describe('compiler + runtime integration', () => {
|
||||
@@ -281,4 +282,14 @@ describe('compiler + runtime integration', () => {
|
||||
await nextTick()
|
||||
expect(container.innerHTML).toBe(`<div>2<div>1</div></div>`)
|
||||
})
|
||||
|
||||
// #2413
|
||||
it('EMPTY_ARR should not change', () => {
|
||||
const App = {
|
||||
template: `<div v-for="v of ['a']">{{ v }}</div>`
|
||||
}
|
||||
const container = document.createElement('div')
|
||||
createApp(App).mount(container)
|
||||
expect(EMPTY_ARR.length).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user