add each_value to contextProps - fixes #1206

pull/1220/head
Rich Harris 7 years ago
parent a8f94f0898
commit ddd67dd844

@ -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`
];

@ -1,17 +1,19 @@
export default {
html: `
<button>racoon</button><button>eagle</button>
<button>racoon</button>
<button>eagle</button>
`,
test ( assert, component, target ) {
assert.htmlEqual( target.innerHTML, `
<button>racoon</button><button>eagle</button>
test(assert, component, target) {
assert.htmlEqual(target.innerHTML,`
<button>racoon</button>
<button>eagle</button>
`);
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');
},
};

@ -1,5 +1,5 @@
{{#each ['racoon', 'eagle'] as animal}}
<button on:click="set({clicked: animal})">{{animal}}</button>
<button on:click="set({clicked: animal})">{{animal}}</button>
{{/each}}
<script>

Loading…
Cancel
Save