Skip to content

Commit 2cf0678

Browse files
committed
test: add test case
1 parent 5c24099 commit 2cf0678

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: packages/runtime-core/__tests__/vnode.spec.ts

+11
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ describe('vnode', () => {
6363
})
6464
})
6565

66+
test('create from an existing text vnode', () => {
67+
const vnode1 = createVNode('div', null, 'text', PatchFlags.TEXT)
68+
const vnode2 = createVNode(vnode1)
69+
expect(vnode2).toMatchObject({
70+
type: 'div',
71+
patchFlag: PatchFlags.BAIL,
72+
children: 'text',
73+
shapeFlag: ShapeFlags.ELEMENT | ShapeFlags.TEXT_CHILDREN
74+
})
75+
})
76+
6677
test('vnode keys', () => {
6778
for (const key of ['', 'a', 0, 1, NaN]) {
6879
expect(createVNode('div', { key }).key).toBe(key)

0 commit comments

Comments
 (0)