File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
packages/svelte/tests/runtime-runes/samples/hydrate-modified-input-numeric Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 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+ } ) ;
Original file line number Diff line number Diff line change 1+ <script >
2+ let value = $state (0 );
3+ </script >
4+
5+ <input type ="number" bind:value ={value }>
6+ {value } ({typeof value })
You can’t perform that action at this time.
0 commit comments