Skip to content

Commit

Permalink
test: add renderer component
Browse files Browse the repository at this point in the history
  • Loading branch information
cuixiaorui committed Jul 17, 2022
1 parent bc17982 commit a1d0819
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions packages/runtime-core/__tests__/rendererComponent.spec.ts
Original file line number Diff line number Diff line change
@@ -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(`<div></div>`);
});
});
2 changes: 1 addition & 1 deletion packages/runtime-core/src/h.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createVNode } from "./vnode";
export const h = (type: string, props: any = null, children: string | Array<any> = []) => {
export const h = (type: any , props: any = null, children: string | Array<any> = []) => {
return createVNode(type, props, children);
};

0 comments on commit a1d0819

Please sign in to comment.