mirror of https://github.com/sveltejs/svelte
parent
72776b0b2a
commit
dfff2957a0
@ -0,0 +1 @@
|
||||
<input bind:value>
|
@ -0,0 +1,30 @@
|
||||
import { Store } from '../../../../store.js';
|
||||
|
||||
const store = new Store({
|
||||
a: ['foo', 'bar', 'baz']
|
||||
});
|
||||
|
||||
export default {
|
||||
store,
|
||||
|
||||
html: `
|
||||
<input><input><input>
|
||||
<p>foo, bar, baz</p>
|
||||
`,
|
||||
|
||||
test(assert, component, target, window) {
|
||||
const event = new window.MouseEvent('input');
|
||||
const inputs = target.querySelectorAll('input');
|
||||
|
||||
inputs[0].value = 'blah';
|
||||
inputs[0].dispatchEvent(event);
|
||||
|
||||
assert.deepEqual(store.get('a'), ['blah', 'bar', 'baz']);
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<input><input><input>
|
||||
<p>blah, bar, baz</p>
|
||||
`);
|
||||
|
||||
component.destroy();
|
||||
},
|
||||
};
|
@ -0,0 +1,15 @@
|
||||
{{#each $a as x}}
|
||||
<Widget bind:value='x'/>
|
||||
{{/each}}
|
||||
|
||||
<p>{{$a.join(', ')}}</p>
|
||||
|
||||
<script>
|
||||
import Widget from './Widget.html';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Widget
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in new issue