0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 17:30:59 +01:00

increase test coverage

This commit is contained in:
Rich Harris 2018-02-10 22:00:32 -05:00
parent 72776b0b2a
commit dfff2957a0
3 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1 @@
<input bind:value>

View File

@ -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();
},
};

View File

@ -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>