all SSR tests passing bar preload/spread

pull/1839/head
Rich Harris 7 years ago
parent 1cd946e2f6
commit 1e8d7af684

@ -7,10 +7,10 @@ export default function(node, renderer: Renderer, options: CompileOptions) {
renderer.render(node.pending.children, options);
renderer.append('`; return function(ctx) { return `');
renderer.append('`; return function(' + (node.value || '') + ') { return `');
renderer.render(node.then.children, options);
const snippet = snip(node.expression);
renderer.append(`\`;}(Object.assign({}, ctx, { ${node.value}: __value }));}(${snippet})) }`);
renderer.append(`\`;}(__value);}(${snippet})) }`);
}

@ -70,7 +70,7 @@ export default function(node, renderer: Renderer, options) {
.concat(binding_props.map(p => `{ ${p} }`))
.join(', ')
})`;
} else if (node.attributes.length || binding_props.length) {
} else {
props = stringifyProps(
node.attributes
.map(attribute => `${attribute.name}: ${getAttributeValue(attribute)}`)

@ -1,5 +1,5 @@
import { set_current_component } from './lifecycle.js';
import { run_all } from './utils.js';
import { run_all, blankObject } from './utils.js';
export const invalidAttributeNameCharacter = /[\s'">\/=\u{FDD0}-\u{FDEF}\u{FFFE}\u{FFFF}\u{1FFFE}\u{1FFFF}\u{2FFFE}\u{2FFFF}\u{3FFFE}\u{3FFFF}\u{4FFFE}\u{4FFFF}\u{5FFFE}\u{5FFFF}\u{6FFFE}\u{6FFFF}\u{7FFFE}\u{7FFFF}\u{8FFFE}\u{8FFFF}\u{9FFFE}\u{9FFFF}\u{AFFFE}\u{AFFFF}\u{BFFFE}\u{BFFFF}\u{CFFFE}\u{CFFFF}\u{DFFFE}\u{DFFFF}\u{EFFFE}\u{EFFFF}\u{FFFFE}\u{FFFFF}\u{10FFFE}\u{10FFFF}]/u;
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
@ -74,7 +74,8 @@ export function create_ssr_component($$render) {
on_mount: [],
on_destroy: [],
before_render: [],
after_render: []
after_render: [],
callbacks: blankObject()
};
set_current_component({ $$ });

@ -1,7 +1,10 @@
export default {
immutable: true,
html: `<div><h3>Called 1 times.</h3></div>`,
ssrHtml: `<div><h3>Called 0 times.</h3></div>`,
test({ assert, component, target, window }) {
var nested = component.nested;

@ -5,10 +5,10 @@
onMount(() => {
events = ['mount'];
});
onDestroy(() => {
events.push('destroy');
return () => {
events.push('destroy');
};
});
</script>

Loading…
Cancel
Save