From 57ba95e898b7df53cd8d7c93e6083538dd313d29 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Wed, 4 Jan 2017 13:34:45 -0500 Subject: [PATCH] fix component yields inside each blocks (#230) --- src/generators/dom/visitors/Component.js | 2 +- .../Widget.html | 1 + .../_config.js | 3 +++ .../main.html | 19 +++++++++++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 test/generator/component-yield-multiple-in-each/Widget.html create mode 100644 test/generator/component-yield-multiple-in-each/_config.js create mode 100644 test/generator/component-yield-multiple-in-each/main.html diff --git a/src/generators/dom/visitors/Component.js b/src/generators/dom/visitors/Component.js index 50bcc98466..540713f360 100644 --- a/src/generators/dom/visitors/Component.js +++ b/src/generators/dom/visitors/Component.js @@ -36,7 +36,7 @@ export default { generator.generateBlock( node, yieldName ); generator.current.builders.init.addLine( - `var ${name}_yieldFragment = ${yieldName}( root, component );` + `var ${name}_yieldFragment = ${yieldName}( ${generator.current.params}, component );` ); generator.current.builders.update.addLine( diff --git a/test/generator/component-yield-multiple-in-each/Widget.html b/test/generator/component-yield-multiple-in-each/Widget.html new file mode 100644 index 0000000000..e147954fa0 --- /dev/null +++ b/test/generator/component-yield-multiple-in-each/Widget.html @@ -0,0 +1 @@ +

{{yield}}

diff --git a/test/generator/component-yield-multiple-in-each/_config.js b/test/generator/component-yield-multiple-in-each/_config.js new file mode 100644 index 0000000000..6a4c62702b --- /dev/null +++ b/test/generator/component-yield-multiple-in-each/_config.js @@ -0,0 +1,3 @@ +export default { + html: '

Hello Alice

Hello Bob

Hello Charles

' +}; diff --git a/test/generator/component-yield-multiple-in-each/main.html b/test/generator/component-yield-multiple-in-each/main.html new file mode 100644 index 0000000000..149e98549c --- /dev/null +++ b/test/generator/component-yield-multiple-in-each/main.html @@ -0,0 +1,19 @@ +{{#each people as person}} + Hello {{person}} +{{/each}} + +