Skip to content

Commit

Permalink
Merge pull request #1046 from sveltejs/gh-1044
Browse files Browse the repository at this point in the history
fix toString method in SSR output
  • Loading branch information
Rich-Harris authored Dec 24, 2017
2 parents 4202c56 + f8362fe commit 8472142
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/generators/server-side-rendering/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export default function ssr(
head: result.head,
css: { code: cssCode, map: null },
toString() {
return result.html;
return html;
}
};
}
Expand Down
2 changes: 1 addition & 1 deletion test/js/samples/ssr-no-oncreate-etc/expected-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ SvelteComponent.render = function(state, options = {}) {
head: result.head,
css: { code: cssCode, map: null },
toString() {
return result.html;
return html;
}
};
};
Expand Down
2 changes: 1 addition & 1 deletion test/js/samples/ssr-no-oncreate-etc/expected.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SvelteComponent.render = function(state, options = {}) {
head: result.head,
css: { code: cssCode, map: null },
toString() {
return result.html;
return html;
}
};
}
Expand Down
6 changes: 5 additions & 1 deletion test/server-side-rendering/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ describe("ssr", () => {

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);
if (css.code) fs.writeFileSync(`${dir}/_actual.css`, css.code);
Expand Down

0 comments on commit 8472142

Please sign in to comment.