Merge pull request #1046 from sveltejs/gh-1044

fix toString method in SSR output
pull/1048/head
Rich Harris 7 years ago committed by GitHub
commit 8472142159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -124,7 +124,7 @@ export default function ssr(
head: result.head, head: result.head,
css: { code: cssCode, map: null }, css: { code: cssCode, map: null },
toString() { toString() {
return result.html; return html;
} }
}; };
} }

@ -25,7 +25,7 @@ SvelteComponent.render = function(state, options = {}) {
head: result.head, head: result.head,
css: { code: cssCode, map: null }, css: { code: cssCode, map: null },
toString() { toString() {
return result.html; return html;
} }
}; };
}; };

@ -27,7 +27,7 @@ SvelteComponent.render = function(state, options = {}) {
head: result.head, head: result.head,
css: { code: cssCode, map: null }, css: { code: cssCode, map: null },
toString() { toString() {
return result.html; return html;
} }
}; };
} }

@ -59,7 +59,11 @@ describe("ssr", () => {
const data = tryToLoadJson(`${dir}/data.json`); const data = tryToLoadJson(`${dir}/data.json`);
const { html, css, head } = component.render(data); const rendered = component.render(data);
const { html, css, head } = rendered;
// rendered.toString() === rendered.html
assert.equal(rendered, html);
fs.writeFileSync(`${dir}/_actual.html`, html); fs.writeFileSync(`${dir}/_actual.html`, html);
if (css.code) fs.writeFileSync(`${dir}/_actual.css`, css.code); if (css.code) fs.writeFileSync(`${dir}/_actual.css`, css.code);

Loading…
Cancel
Save