mirror of https://github.com/sveltejs/svelte
fix: only `select_option` if `'value'` is in `next` (#16032)
parent
0d67ff4865
commit
c9ce4f439f
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: only `select_option` if `'value'` is in `next`
|
@ -0,0 +1,20 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { ok, test } from '../../test';
|
||||
|
||||
export default test({
|
||||
async test({ assert, target }) {
|
||||
const select = target.querySelector('select');
|
||||
ok(select);
|
||||
const [option1, option2] = select;
|
||||
|
||||
assert.ok(option1.selected);
|
||||
assert.ok(!option2.selected);
|
||||
|
||||
const btn = target.querySelector('button');
|
||||
flushSync(() => {
|
||||
btn?.click();
|
||||
});
|
||||
assert.ok(option1.selected);
|
||||
assert.ok(!option2.selected);
|
||||
}
|
||||
});
|
@ -0,0 +1,10 @@
|
||||
<script>
|
||||
let { value = "Hello", spread = { disabled: false } } = $props();
|
||||
</script>
|
||||
|
||||
<button onclick={()=> spread = { disabled: false }}></button>
|
||||
|
||||
<select bind:value {...spread}>
|
||||
<option>Hello</option>
|
||||
<option>World</option>
|
||||
</select>
|
Loading…
Reference in new issue