Skip to content

Commit 61d75e1

Browse files
committed
test: add test
1 parent 4fdb550 commit 61d75e1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

packages/runtime-core/__tests__/componentSlots.spec.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
nodeOps,
77
ref,
88
render,
9+
useSlots,
910
} from '@vue/runtime-test'
1011
import { createBlock, normalizeVNode } from '../src/vnode'
1112
import { createSlots } from '../src/helpers/createSlots'
@@ -42,6 +43,19 @@ describe('component: slots', () => {
4243
expect(slots).toMatchObject({})
4344
})
4445

46+
test('initSlots: ensure compiler marker non-enumerable', () => {
47+
const Comp = {
48+
render() {
49+
const slots = useSlots()
50+
// should not have compiler marker(`_` and `__`)
51+
expect(Object.keys(slots)).toMatchObject(['foo'])
52+
return h('div')
53+
},
54+
}
55+
const slots = { foo: () => {}, _: 1, __: [1] }
56+
render(createBlock(Comp, null, slots), nodeOps.createElement('div'))
57+
})
58+
4559
test('initSlots: should normalize object slots (when value is null, string, array)', () => {
4660
const { slots } = renderWithSlots({
4761
_inner: '_inner',

0 commit comments

Comments
 (0)