UNPKG

reshow-build

Version:
46 lines 1.6 kB
var _div, _div2; //@ts-check import * as React from "react"; import { expect } from "chai"; import { render } from "reshow-unit"; import build from "../index.mjs"; import { jsx as _jsx } from "react/jsx-runtime"; describe("Test string render", function () { it("test build string", function () { var vdom = /**@type React.ReactElement*/build("Foo Bar")(); var actual = render(vdom).html(); expect(actual).to.equal("<span>Foo Bar</span>"); }); it("test build string with child", function () { var vdom = /**@type React.ReactElement*/build("Foo Bar")({}, _div || (_div = /*#__PURE__*/_jsx("div", {}))); var actual = render(vdom).html(); expect(actual).to.equal("<span>Foo Bar</span>"); }); it("test build string with params has child", function () { var run = function run() { var vdom = /**@type React.ReactElement*/ build("Foo Bar")({ children: _div2 || (_div2 = /*#__PURE__*/_jsx("div", {})) }); render(vdom).html(); }; expect(run).throw(TypeError); }); var _loop = function _loop(i) { it("test render h" + i, function () { var vdom = /**@type React.ReactElement*/build("h" + i)(); var actual = render(vdom).html(); expect(actual).to.equal("<h" + i + "></h" + i + ">"); }); }; for (var i = 1, j = 7; i < j; i++) { _loop(i); } [0, 7, 8, 9].forEach(function (i) { it("test render h" + i, function () { var vdom = /**@type React.ReactElement*/build("h" + i)(); var actual = render(vdom).html(); expect(actual).to.equal("<span>h" + i + "</span>"); }); }); });