fix: attributes on <body> not being rendered (#1648)
This commit is contained in:
@@ -67,6 +67,7 @@ export function renderOuterDocument(
|
||||
docHead,
|
||||
renderedHtmlTag,
|
||||
docTitle,
|
||||
docBody,
|
||||
docHeadNodes,
|
||||
headVNodes,
|
||||
} = state;
|
||||
@@ -90,7 +91,10 @@ export function renderOuterDocument(
|
||||
h("link", { rel: "modulepreload", href: src })
|
||||
),
|
||||
headVNodes,
|
||||
h("body", { dangerouslySetInnerHTML: { __html: opts.bodyHtml } }),
|
||||
h("body", {
|
||||
...docBody,
|
||||
dangerouslySetInnerHTML: { __html: opts.bodyHtml },
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -66,3 +66,15 @@ Deno.test("don't duplicate <title>", async () => {
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
Deno.test("sets <html> + <head> + <body> classes", async () => {
|
||||
await withFresh(
|
||||
"./tests/fixture_explicit_app/main.ts",
|
||||
async (address) => {
|
||||
const doc = await fetchHtml(`${address}`);
|
||||
assertSelector(doc, "html.html");
|
||||
assertSelector(doc, "head.head");
|
||||
assertSelector(doc, "body.body");
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -9,13 +9,13 @@ export default function App(
|
||||
{ Component, state }: AppProps<unknown, { lang: string }>,
|
||||
) {
|
||||
return (
|
||||
<html lang={state.lang}>
|
||||
<head>
|
||||
<html lang={state.lang} class="html">
|
||||
<head class="head">
|
||||
<meta charSet="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>fresh title</title>
|
||||
</head>
|
||||
<body>
|
||||
<body class="body">
|
||||
<div class="inner-body">
|
||||
<Component />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user