import { HarmajaStaticOutput } from "./harmaja" ; import * as H from "./index" ; export * from "./observable/test-utils" ; export function mounted ( element ) { const parent = document . createElement ( "html" ) ; const root = document . createElement ( "div" ) ; parent . appendChild ( root ) ; H . mount ( element , root ) ; return element as HarmajaStaticOutput ; } export function renderAsString ( output ) { return getHtml ( mounted ( output ) ) ; } export function getHtml ( element ) { if ( element instanceof Array ) { return element . map ( getHtml ) . join ( "" ) ; } else { if ( element instanceof HTMLElement ) { return element . outerHTML ; } else { return element . textContent || "" ; } } } export function wait ( delay ) { return new Promise ( ( resolve ) => setTimeout ( resolve , delay ) ) ; }