Skip to content

Commit 098047b

Browse files
committed
add test
1 parent f75c0a4 commit 098047b

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { test } from '../../test';
2+
3+
export default test({
4+
skip_mode: ['client'],
5+
6+
test({ assert, target, hydrate }) {
7+
const inputs = /** @type {NodeListOf<HTMLInputElement>} */ (target.querySelectorAll('input'));
8+
inputs[1].checked = true;
9+
inputs[1].dispatchEvent(new window.Event('change'));
10+
// Hydration shouldn't reset the value to 1
11+
hydrate();
12+
13+
assert.htmlEqual(
14+
target.innerHTML,
15+
'<input type="radio" value="1"><input type="radio" value="2"><input type="radio" value="3">\n2'
16+
);
17+
}
18+
});
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<script>
2+
let value = $state(1);
3+
</script>
4+
5+
{#each [1, 2, 3] as number}
6+
<input type="radio" value={number} bind:group={value}>
7+
{/each}
8+
9+
{value}

0 commit comments

Comments
 (0)