Skip to content

Commit 6b32f00

Browse files
committed
add test
1 parent 702b933 commit 6b32f00

File tree

2 files changed

+23
-0
lines changed

2 files changed

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

0 commit comments

Comments
 (0)