Skip to content

Commit

Permalink
correctly update yield fragment inside each, #230
Browse files Browse the repository at this point in the history
  • Loading branch information
Swatinem committed Jan 5, 2017
1 parent f5ebc85 commit 20e1b05
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/generators/dom/visitors/Component.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default {
// Component has children, put them in a separate {{yield}} block
if ( hasChildren ) {
const yieldName = generator.getUniqueName( `render${name}YieldFragment` );
const { params } = generator.current;

generator.generateBlock( node, yieldName );

Expand All @@ -40,7 +41,7 @@ export default {
);

generator.current.builders.update.addLine(
`${name}_yieldFragment.update( changed, root );`
`${name}_yieldFragment.update( changed, ${params} );`
);

componentInitProperties.push( `_yield: ${name}_yieldFragment`);
Expand Down
9 changes: 8 additions & 1 deletion test/generator/component-yield-multiple-in-each/_config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
export default {
html: '<p>Hello Alice</p><p>Hello Bob</p><p>Hello Charles</p>'
html: '<p>Hello Alice</p><p>Hello Bob</p><p>Hello Charles</p>',

test ( assert, component, target ) {
component.set({
people: [ 'Alice', 'Charles', 'Bob' ]
});
assert.htmlEqual( target.innerHTML, `<p>Hello Alice</p><p>Hello Charles</p><p>Hello Bob</p>` );
}
};

0 comments on commit 20e1b05

Please sign in to comment.