`)
// Perform some state change. This change should be preserved after the
// re-render!
triggerEvent(root.children[0] as TestElement, 'click')
await nextTick()
expect(serializeInner(root)).toBe(`
11
`)
// // Update text while preserving state
rerender(
parentId,
compileToFunction(
`
{{ count }}!{{ count }}
`
)
)
expect(serializeInner(root)).toBe(`
1!1
`)
// Should force child update on slot content change
rerender(
parentId,
compileToFunction(
`
{{ count }}!{{ count }}!
`
)
)
expect(serializeInner(root)).toBe(`
1!1!
`)
// Should force update element children despite block optimization
rerender(
parentId,
compileToFunction(
`
{{ count }}{{ count }}{{ count }}!
`
)
)
expect(serializeInner(root)).toBe(`
111!
`)
// Should force update child slot elements
rerender(
parentId,
compileToFunction(
`
`)
expect(unmountSpy).toHaveBeenCalledTimes(1)
expect(mountSpy).toHaveBeenCalledTimes(1)
})
// #1156 - static nodes should retain DOM element reference across updates
// when HMR is active
test('static el reference', async () => {
const root = nodeOps.createElement('div')
const id = 'test-static-el'
const template = `