mirror of https://github.com/sveltejs/svelte
fix context for bindings (#685)
parent
ef33466c12
commit
01ec3000f3
@ -0,0 +1,32 @@
|
||||
export default {
|
||||
skip: true, // JSDOM...
|
||||
|
||||
html: `
|
||||
<select>
|
||||
<option value='hullo'>Hullo</option>
|
||||
<option value='world'>World</option>
|
||||
</select>
|
||||
|
||||
<select>
|
||||
<option value='hullo'>Hullo</option>
|
||||
<option value='world'>World</option>
|
||||
</select>
|
||||
`,
|
||||
|
||||
data: {
|
||||
items: [{ value: 'hullo' }, { value: 'world' }]
|
||||
},
|
||||
|
||||
test(assert, component, target, window) {
|
||||
const selects = [...target.querySelectorAll('select')];
|
||||
|
||||
const change = new window.Event('change');
|
||||
|
||||
selects[1].options[0].selected = true;
|
||||
selects[1].dispatchEvent(change);
|
||||
|
||||
assert.deepEqual(component.get('items'), [
|
||||
{ value: 'hullo' }, { value: 'hullo' }
|
||||
]);
|
||||
}
|
||||
};
|
@ -0,0 +1,6 @@
|
||||
{{#each items as item}}
|
||||
<select bind:value="item.value">
|
||||
<option value="hullo">Hullo</option>
|
||||
<option value="world">World</option>
|
||||
</select>
|
||||
{{/each}}
|
Loading…
Reference in new issue