release: WRNexusJS 0.3.5
This commit is contained in:
@@ -36,6 +36,24 @@ test("always emits a document language and preserves an explicit language", () =
|
||||
expect(explicit).not.toContain('lang="en"');
|
||||
});
|
||||
|
||||
test("merges framework head and scripts into an application document template", () => {
|
||||
const html = renderDocument({
|
||||
meta: { title: "Document layout" },
|
||||
body: "",
|
||||
htmlAttrs: ' data-theme="dark"',
|
||||
scripts: ["/page.js"],
|
||||
documentTemplate:
|
||||
'<html data-ui-font="system"><head><meta name="custom" content="yes" /></head><body><div id="app">Page</div></body></html>',
|
||||
});
|
||||
expect(html).toStartWith("<!doctype html>");
|
||||
expect(html).toContain('<html data-ui-font="system" data-theme="dark" lang="en">');
|
||||
expect(html).toContain("<title>Document layout</title>");
|
||||
expect(html).toContain('<meta name="custom" content="yes" />');
|
||||
expect(html).toContain('<script type="module" src="/page.js"></script>');
|
||||
expect(html.match(/<html/g)).toHaveLength(1);
|
||||
expect(html.match(/<body/g)).toHaveLength(1);
|
||||
});
|
||||
|
||||
test("streams async body chunks inside the document shell", async () => {
|
||||
async function* body() {
|
||||
yield "<h1>Shell</h1>";
|
||||
|
||||
Reference in New Issue
Block a user