mirror of https://github.com/sveltejs/svelte
Merge pull request #641 from sveltejs/gh-639-a
Sync state with view if <select> binding does not have initial valuepull/644/head
commit
5c26f81f53
@ -0,0 +1,25 @@
|
||||
export default {
|
||||
'skip-ssr': true, // TODO would be nice to fix this in SSR as well
|
||||
|
||||
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