mirror of https://github.com/sveltejs/svelte
Merge branch 'master' of https://github.com/saibotsivad/svelte into taylorzane-hotfix/initialize-select-element
commit
472a5f752d
@ -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 );
|
||||
}
|
||||
};
|
@ -0,0 +1,5 @@
|
||||
<select bind:value="foo">
|
||||
{{#each items as item}}
|
||||
<option value='{{item.id}}'>{{item.id}}</option>
|
||||
{{/each}}
|
||||
</select>
|
Loading…
Reference in new issue