diff --git a/packages/runtime-core/__tests__/rendererComponent.spec.ts b/packages/runtime-core/__tests__/rendererComponent.spec.ts new file mode 100644 index 0000000..e606094 --- /dev/null +++ b/packages/runtime-core/__tests__/rendererComponent.spec.ts @@ -0,0 +1,15 @@ +import { h } from "@mini-vue/runtime-dom"; +import { nodeOps, render, serializeInner } from "@mini-vue/runtime-test"; + +describe("renderer: component", () => { + it("should create an Component ", () => { + const Comp = { + render: () => { + return h("div"); + }, + }; + const root = nodeOps.createElement("div"); + render(h(Comp), root); + expect(serializeInner(root)).toBe(`
`); + }); +}); diff --git a/packages/runtime-core/src/h.ts b/packages/runtime-core/src/h.ts index fc86ed9..ba305b4 100644 --- a/packages/runtime-core/src/h.ts +++ b/packages/runtime-core/src/h.ts @@ -1,4 +1,4 @@ import { createVNode } from "./vnode"; -export const h = (type: string, props: any = null, children: string | Array = []) => { +export const h = (type: any , props: any = null, children: string | Array = []) => { return createVNode(type, props, children); };