mirror of https://github.com/sveltejs/svelte
possible fix for #893
parent
0a7d39d08f
commit
5646df77ac
@ -0,0 +1,32 @@
|
||||
export default {
|
||||
dev: true,
|
||||
|
||||
html: `
|
||||
<select>
|
||||
<option value='A'>A</option>
|
||||
<option value='B'>B</option>
|
||||
<option value='C'>C</option>
|
||||
</select>
|
||||
`,
|
||||
|
||||
test(assert, component, target, window) {
|
||||
const select = target.querySelector('select');
|
||||
const options = target.querySelectorAll('option');
|
||||
|
||||
const change = new window.Event('change');
|
||||
|
||||
options[1].selected = true;
|
||||
select.dispatchEvent(change);
|
||||
|
||||
assert.equal(component.get('selected').letter, 'B');
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<select>
|
||||
<option value='A'>A</option>
|
||||
<option value='B'>B</option>
|
||||
<option value='C'>C</option>
|
||||
</select>
|
||||
|
||||
B
|
||||
`);
|
||||
}
|
||||
};
|
@ -0,0 +1,27 @@
|
||||
<select bind:value="selected.letter">
|
||||
{{#each uppercase as letter}}
|
||||
<option value="{{letter}}">{{letter}}</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
|
||||
{{selected.letter}}
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
letters: [
|
||||
'a',
|
||||
'b',
|
||||
'c'
|
||||
],
|
||||
selected: {
|
||||
letter: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
uppercase: letters => letters.map(x => x.toUpperCase())
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in new issue