failing tests for second bug in #290

pull/299/head
Rich Harris 8 years ago
parent b31ecc5649
commit 8b71d7be8c

@ -0,0 +1,28 @@
export default {
html: `
<input>
<input>
<input>
<p>foo, bar, baz</p>
`,
test ( assert, component, target, window ) {
const change = new window.MouseEvent( 'change' );
const inputs = target.querySelectorAll( 'input' );
inputs[0].value = 'blah';
inputs[0].dispatchEvent( change );
assert.deepEqual( component.get( 'a' ), [ 'blah', 'bar', 'baz' ] );
assert.htmlEqual( target.innerHTML, `
<input>
<input>
<input>
<p>blah, bar, baz</p>
` );
component.teardown();
}
};

@ -0,0 +1,22 @@
{{#each a as x}}
<Widget bind:value='x.name'/>
{{/each}}
<p>{{a.map(getName).join(', ')}}</p>
<script>
import Widget from './Widget.html';
export default {
data () {
return {
a: [{ name: 'foo' }, { name: 'bar' }, { name: 'baz' }],
getName: x => x.name
};
},
components: {
Widget
}
};
</script>

@ -0,0 +1,28 @@
export default {
html: `
<input>
<input>
<input>
<p>foo, bar, baz</p>
`,
test ( assert, component, target, window ) {
const change = new window.MouseEvent( 'change' );
const inputs = target.querySelectorAll( 'input' );
inputs[0].value = 'blah';
inputs[0].dispatchEvent( change );
assert.deepEqual( component.get( 'a' ), [ 'blah', 'bar', 'baz' ] );
assert.htmlEqual( target.innerHTML, `
<input>
<input>
<input>
<p>blah, bar, baz</p>
` );
component.teardown();
}
};

@ -0,0 +1,21 @@
{{#each a as x}}
<Widget bind:value='x'/>
{{/each}}
<p>{{a.join(', ')}}</p>
<script>
import Widget from './Widget.html';
export default {
data () {
return {
a: [ 'foo', 'bar', 'baz' ]
};
},
components: {
Widget
}
};
</script>
Loading…
Cancel
Save