diff --git a/src/generators/dom/visitors/Component/Component.js b/src/generators/dom/visitors/Component/Component.js index c54945338def..9a2dbf0025ca 100644 --- a/src/generators/dom/visitors/Component/Component.js +++ b/src/generators/dom/visitors/Component/Component.js @@ -113,9 +113,11 @@ export default function visitComponent ( generator, block, state, node ) { `var ${yieldFragment} = ${childBlock.name}( ${params}, ${block.component} );` ); - block.builders.update.addLine( - `${yieldFragment}.update( changed, ${params} );` - ); + if ( childBlock.hasUpdateMethod ) { + block.builders.update.addLine( + `${yieldFragment}.update( changed, ${params} );` + ); + } componentInitProperties.push( `_yield: ${yieldFragment}`); } @@ -183,4 +185,4 @@ export default function visitComponent ( generator, block, state, node ) { block.builders.create.addBlock( local.create ); if ( !local.update.isEmpty() ) block.builders.update.addBlock( local.update ); -} \ No newline at end of file +} diff --git a/test/runtime/samples/component-yield-static/Widget.html b/test/runtime/samples/component-yield-static/Widget.html new file mode 100644 index 000000000000..25141c925499 --- /dev/null +++ b/test/runtime/samples/component-yield-static/Widget.html @@ -0,0 +1 @@ +{{yield}} diff --git a/test/runtime/samples/component-yield-static/_config.js b/test/runtime/samples/component-yield-static/_config.js new file mode 100644 index 000000000000..06bcd82882b0 --- /dev/null +++ b/test/runtime/samples/component-yield-static/_config.js @@ -0,0 +1,12 @@ +export default { + html: ` + Hello + `, + + test ( assert, component, target ) { + component.set( { name: 'World' } ); + assert.htmlEqual( target.innerHTML, ` + Hello World + ` ); + } +}; diff --git a/test/runtime/samples/component-yield-static/main.html b/test/runtime/samples/component-yield-static/main.html new file mode 100644 index 000000000000..5e2fffc76a46 --- /dev/null +++ b/test/runtime/samples/component-yield-static/main.html @@ -0,0 +1,12 @@ +Hello {{name}} + +