mirror of https://github.com/sveltejs/svelte
Merge pull request #457 from sveltejs/gh-423
correctly bind one-way select value attributes (#423)pull/458/head
commit
e82c478299
@ -0,0 +1,24 @@
|
||||
const items = [ {}, {} ];
|
||||
|
||||
export default {
|
||||
skip: true, // JSDOM quirks
|
||||
|
||||
'skip-ssr': true,
|
||||
|
||||
data: {
|
||||
foo: items[0],
|
||||
items
|
||||
},
|
||||
|
||||
test ( assert, component, target ) {
|
||||
const options = target.querySelectorAll( 'option' );
|
||||
|
||||
assert.equal( options[0].selected, true );
|
||||
assert.equal( options[1].selected, false );
|
||||
|
||||
component.set( { foo: items[1] } );
|
||||
|
||||
assert.equal( options[0].selected, false );
|
||||
assert.equal( options[1].selected, true );
|
||||
}
|
||||
};
|
@ -0,0 +1,4 @@
|
||||
<select value="{{foo}}">
|
||||
<option value='{{items[0]}}'>a</option>
|
||||
<option value='{{items[1]}}'>b</option>
|
||||
</select>
|
Loading…
Reference in new issue