mirror of https://github.com/sveltejs/svelte
parent
f75c0a4d60
commit
098047b37a
@ -0,0 +1,18 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
skip_mode: ['client'],
|
||||
|
||||
test({ assert, target, hydrate }) {
|
||||
const inputs = /** @type {NodeListOf<HTMLInputElement>} */ (target.querySelectorAll('input'));
|
||||
inputs[1].checked = true;
|
||||
inputs[1].dispatchEvent(new window.Event('change'));
|
||||
// Hydration shouldn't reset the value to 1
|
||||
hydrate();
|
||||
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
'<input type="radio" value="1"><input type="radio" value="2"><input type="radio" value="3">\n2'
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,9 @@
|
||||
<script>
|
||||
let value = $state(1);
|
||||
</script>
|
||||
|
||||
{#each [1, 2, 3] as number}
|
||||
<input type="radio" value={number} bind:group={value}>
|
||||
{/each}
|
||||
|
||||
{value}
|
||||
Loading…
Reference in new issue