Skip to content

Commit f8362fe

Browse files
committed
fix toString method in SSR output - closes #1044
1 parent 4202c56 commit f8362fe

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

src/generators/server-side-rendering/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export default function ssr(
124124
head: result.head,
125125
css: { code: cssCode, map: null },
126126
toString() {
127-
return result.html;
127+
return html;
128128
}
129129
};
130130
}

test/js/samples/ssr-no-oncreate-etc/expected-bundle.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SvelteComponent.render = function(state, options = {}) {
2525
head: result.head,
2626
css: { code: cssCode, map: null },
2727
toString() {
28-
return result.html;
28+
return html;
2929
}
3030
};
3131
};

test/js/samples/ssr-no-oncreate-etc/expected.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ SvelteComponent.render = function(state, options = {}) {
2727
head: result.head,
2828
css: { code: cssCode, map: null },
2929
toString() {
30-
return result.html;
30+
return html;
3131
}
3232
};
3333
}

test/server-side-rendering/index.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ describe("ssr", () => {
5959

6060
const data = tryToLoadJson(`${dir}/data.json`);
6161

62-
const { html, css, head } = component.render(data);
62+
const rendered = component.render(data);
63+
const { html, css, head } = rendered;
64+
65+
// rendered.toString() === rendered.html
66+
assert.equal(rendered, html);
6367

6468
fs.writeFileSync(`${dir}/_actual.html`, html);
6569
if (css.code) fs.writeFileSync(`${dir}/_actual.css`, css.code);

0 commit comments

Comments
 (0)