test(runtime-core): add test case for createBlock
with disableTracking (#1169)
This commit is contained in:
parent
efa3214866
commit
520cad7d4d
@ -405,6 +405,39 @@ describe('vnode', () => {
|
|||||||
}))
|
}))
|
||||||
expect(vnode.dynamicChildren).toStrictEqual([vnode1])
|
expect(vnode.dynamicChildren).toStrictEqual([vnode1])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
test('openBlock w/ disableTracking: true', () => {
|
||||||
|
const hoist = createVNode('div')
|
||||||
|
let vnode1
|
||||||
|
const vnode = (openBlock(),
|
||||||
|
createBlock('div', null, [
|
||||||
|
// a v-for fragment block generated by the compiler
|
||||||
|
// disables tracking because it always diffs its
|
||||||
|
// children.
|
||||||
|
(vnode1 = (openBlock(true),
|
||||||
|
createBlock(Fragment, null, [
|
||||||
|
hoist,
|
||||||
|
/*vnode2*/ createVNode(() => {}, null, 'text')
|
||||||
|
])))
|
||||||
|
]))
|
||||||
|
expect(vnode.dynamicChildren).toStrictEqual([vnode1])
|
||||||
|
expect(vnode1.dynamicChildren).toStrictEqual([])
|
||||||
|
})
|
||||||
|
|
||||||
|
test('openBlock without disableTracking: true', () => {
|
||||||
|
const hoist = createVNode('div')
|
||||||
|
let vnode1, vnode2
|
||||||
|
const vnode = (openBlock(),
|
||||||
|
createBlock('div', null, [
|
||||||
|
(vnode1 = (openBlock(),
|
||||||
|
createBlock(Fragment, null, [
|
||||||
|
hoist,
|
||||||
|
(vnode2 = createVNode(() => {}, null, 'text'))
|
||||||
|
])))
|
||||||
|
]))
|
||||||
|
expect(vnode.dynamicChildren).toStrictEqual([vnode1])
|
||||||
|
expect(vnode1.dynamicChildren).toStrictEqual([vnode2])
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('transformVNodeArgs', () => {
|
describe('transformVNodeArgs', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user