Skip to content

Commit e5b2c93

Browse files
committed
test and changeset
1 parent 93d9fa2 commit e5b2c93

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

.changeset/stale-books-perform.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'svelte': patch
3+
---
4+
5+
fix: take into account setters when spreading and binding
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
});
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<script>
2+
let { value, ...props } = $props();
3+
4+
</script>
5+
6+
<button {...props} onclick={() => value++}>{value}</button>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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>

0 commit comments

Comments
 (0)