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:
parent
72776b0b2a
commit
dfff2957a0
@ -0,0 +1 @@
|
||||
<input bind:value>
|
30
test/runtime/samples/store-component-binding-each/_config.js
Normal file
30
test/runtime/samples/store-component-binding-each/_config.js
Normal 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();
|
||||
},
|
||||
};
|
15
test/runtime/samples/store-component-binding-each/main.html
Normal file
15
test/runtime/samples/store-component-binding-each/main.html
Normal 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>
|
Loading…
Reference in New Issue
Block a user