import { render, CustomElement, Host, defineElement, state, prop } from "@cerxes/csx"; import { testContainer } from "../utils/test-container"; import { nextAnimationFrame } from "../utils/next-animation-frame"; describe("Function components", () => { /** * Assert that a basic component renders as expected */ test("Simple example-component", async () => { function FuncComponent(props, children){ return (
Header
{children}
) } @defineElement('test-component') class TestComponent extends CustomElement{ render(){ return ( I am example content ) } } let container = testContainer( render() ); document.body.appendChild(container);// Components need to be added to the DOM or their connectecCallback will not be called expect( container.innerHTML ).toBe([ ``, `
`, `
`, `Header`, `
`, `
`, `I am example content`, `
`, `
`, `
`, ].join('')); document.body.removeChild(container); }); });