import { h } from '../src/h'
import { createVNode } from '../src/vnode'
+import { RawSlots } from '../src/componentSlots'
// Since h is a thin layer on top of createVNode, we are only testing its
// own logic here. Details of vnode creation is tested in vnode.spec.ts.
test('type + props + children', () => {
// array
expect(h('div', {}, ['foo'])).toMatchObject(createVNode('div', {}, ['foo']))
- // default slot
+ // slots
+ const slots = {} as RawSlots
+ expect(h('div', {}, slots)).toMatchObject(createVNode('div', {}, slots))
const Component = { template: '<br />' }
+ expect(h(Component, {}, slots)).toMatchObject(
+ createVNode(Component, {}, slots)
+ )
+ // default slot
const slot = () => {}
expect(h(Component, {}, slot)).toMatchObject(
createVNode(Component, {}, slot)
expectError(h('div', { ref: {} }))
// @ts-expect-error
expectError(h('div', { ref: 123 }))
+ // slots
+ const slots = { default: () => {} } // RawSlots
+ h('div', {}, slots)
})
describe('h inference w/ Fragment', () => {