Merge pull request #515 from sveltejs/gh-514

only call .update on yield fragment if it's present (#514)
pull/517/head
Rich Harris 8 years ago committed by GitHub
commit 66929cd231

@ -113,9 +113,11 @@ export default function visitComponent ( generator, block, state, node ) {
`var ${yieldFragment} = ${childBlock.name}( ${params}, ${block.component} );` `var ${yieldFragment} = ${childBlock.name}( ${params}, ${block.component} );`
); );
if ( childBlock.hasUpdateMethod ) {
block.builders.update.addLine( block.builders.update.addLine(
`${yieldFragment}.update( changed, ${params} );` `${yieldFragment}.update( changed, ${params} );`
); );
}
componentInitProperties.push( `_yield: ${yieldFragment}`); componentInitProperties.push( `_yield: ${yieldFragment}`);
} }

@ -0,0 +1,12 @@
export default {
html: `
<b>Hello</b>
`,
test ( assert, component, target ) {
component.set( { name: 'World' } );
assert.htmlEqual( target.innerHTML, `
<b>Hello</b> World
` );
}
};

@ -0,0 +1,12 @@
<Widget>Hello</Widget> {{name}}
<script>
import Widget from './Widget.html';
export default {
components: { Widget },
data() {
return { name: '' };
}
};
</script>
Loading…
Cancel
Save