def test_as_page(): utf8 = H.meta( {"http-equiv": "Content-type"}, content="text/html", charset="UTF-8" ) assert real_hrepr.page(1) == H.inline( H.raw("<!DOCTYPE html>"), H.html(H.head(utf8, H.style(css_hrepr)), H.body(real_hrepr(1)),), )
def test_as_page(): tag = H.div("simplicity") utf8 = H.meta({"http-equiv": "Content-type"}, content="text/html", charset="UTF-8") page = H.inline( H.raw("<!DOCTYPE html>"), H.html(H.head(utf8), H.body(tag)), ) assert tag.as_page() == page
def test_as_page_with_resources(): sty = H.style("b { color: red; }") scr = H.script("x = 1234;") resources = (sty, scr) inner = H.b("resources").fill(resources=scr) tag = H.div("with ", inner).fill(resources=sty) utf8 = H.meta({"http-equiv": "Content-type"}, content="text/html", charset="UTF-8") page = H.inline( H.raw("<!DOCTYPE html>"), H.html(H.head(utf8, *resources), H.body(tag)), ) assert tag.as_page() == page