0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-12-01 01:11:24 +01:00

Merge branch 'master' of https://github.com/saibotsivad/svelte into taylorzane-hotfix/initialize-select-element

This commit is contained in:
Rich-Harris 2017-04-19 09:00:29 -04:00
commit 472a5f752d
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,22 @@
const items = [ { id: 'a' }, { id: 'b' } ];
export default {
'skip-ssr': true,
data: {
foo: 'b',
items
},
test ( assert, component, target ) {
const options = target.querySelectorAll( 'option' );
assert.equal( options[0].selected, false );
assert.equal( options[1].selected, true );
component.set( { foo: items[0].id } );
assert.equal( options[0].selected, true );
assert.equal( options[1].selected, false );
}
};

View File

@ -0,0 +1,5 @@
<select bind:value="foo">
{{#each items as item}}
<option value='{{item.id}}'>{{item.id}}</option>
{{/each}}
</select>