File tree Expand file tree Collapse file tree 4 files changed +44
-0
lines changed
packages/svelte/tests/runtime-runes/samples/bind-and-spread Expand file tree Collapse file tree 4 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' svelte ' : patch
3
+ ---
4
+
5
+ fix: take into account setters when spreading and binding
Original file line number Diff line number Diff line change
1
+ import { test } from '../../test' ;
2
+
3
+ export default test ( {
4
+ html : `<button class="foo">0</button><button class="foo">0</button>` ,
5
+
6
+ async test ( { assert, target } ) {
7
+ const [ btn1 , btn2 ] = target . querySelectorAll ( 'button' ) ;
8
+
9
+ await btn1 ?. click ( ) ;
10
+ assert . htmlEqual (
11
+ target . innerHTML ,
12
+ `<button class="foo">1</button><button class="foo">1</button>`
13
+ ) ;
14
+
15
+ await btn2 ?. click ( ) ;
16
+ assert . htmlEqual (
17
+ target . innerHTML ,
18
+ `<button class="foo">2</button><button class="foo">2</button>`
19
+ ) ;
20
+ }
21
+ } ) ;
Original file line number Diff line number Diff line change
1
+ <script >
2
+ let { value, ... props } = $props ();
3
+
4
+ </script >
5
+
6
+ <button {...props } onclick ={() => value ++ }>{value }</button >
Original file line number Diff line number Diff line change
1
+ <script >
2
+ import Button from ' ./button.svelte' ;
3
+
4
+ let value = $state (0 );
5
+
6
+ const props = {
7
+ class: ' foo'
8
+ };
9
+ </script >
10
+
11
+ <Button {...props } bind:value />
12
+ <button {...props } onclick ={() => value ++ }>{value }</button >
You can’t perform that action at this time.
0 commit comments