mirror of https://github.com/sveltejs/svelte
sync state with view, if <select> binding does not have initial value (#639)
parent
5dc12bbe84
commit
d3d026a510
@ -0,0 +1,26 @@
|
||||
export default {
|
||||
solo: true,
|
||||
show: true,
|
||||
|
||||
html: `
|
||||
<p>selected: a</p>
|
||||
|
||||
<select>
|
||||
<option>a</option>
|
||||
<option>b</option>
|
||||
<option>c</option>
|
||||
</select>
|
||||
|
||||
<p>selected: a</p>
|
||||
`,
|
||||
|
||||
test ( assert, component, target ) {
|
||||
const select = target.querySelector( 'select' );
|
||||
const options = [ ...target.querySelectorAll( 'option' ) ];
|
||||
|
||||
assert.equal( select.value, 'a' );
|
||||
assert.ok( options[0].selected );
|
||||
|
||||
component.destroy();
|
||||
}
|
||||
};
|
@ -0,0 +1,9 @@
|
||||
<p>selected: {{selected}}</p>
|
||||
|
||||
<select bind:value='selected'>
|
||||
<option>a</option>
|
||||
<option>b</option>
|
||||
<option>c</option>
|
||||
</select>
|
||||
|
||||
<p>selected: {{selected}}</p>
|
Loading…
Reference in new issue