diff --git a/src/generators/nodes/EachBlock.ts b/src/generators/nodes/EachBlock.ts index 97671c37b0..e75e1722ae 100644 --- a/src/generators/nodes/EachBlock.ts +++ b/src/generators/nodes/EachBlock.ts @@ -75,6 +75,7 @@ export default class EachBlock extends Node { } this.contextProps = [ + `${this.block.listName}: ${this.block.listName}`, `${this.context}: ${this.block.listName}[#i]`, `${this.block.indexName}: #i` ]; diff --git a/test/runtime/samples/each-block-array-literal/_config.js b/test/runtime/samples/each-block-array-literal/_config.js index 7fcc477038..bc36cdbe0e 100644 --- a/test/runtime/samples/each-block-array-literal/_config.js +++ b/test/runtime/samples/each-block-array-literal/_config.js @@ -1,17 +1,19 @@ export default { html: ` - + + `, - test ( assert, component, target ) { - assert.htmlEqual( target.innerHTML, ` - + test(assert, component, target) { + assert.htmlEqual(target.innerHTML,` + + `); - const button = target.querySelector( 'button' ); - const event = new window.MouseEvent( 'click' ); + const button = target.querySelector('button'); + const event = new window.MouseEvent('click'); - button.dispatchEvent( event ); - assert.equal( component.get( 'clicked' ), 'racoon' ); + button.dispatchEvent(event); + assert.equal(component.get('clicked'), 'racoon'); }, }; diff --git a/test/runtime/samples/each-block-array-literal/main.html b/test/runtime/samples/each-block-array-literal/main.html index 8dca00c92e..8c55e94612 100644 --- a/test/runtime/samples/each-block-array-literal/main.html +++ b/test/runtime/samples/each-block-array-literal/main.html @@ -1,5 +1,5 @@ {{#each ['racoon', 'eagle'] as animal}} - + {{/each}}