Skip to content

Commit 9ee1a17

Browse files
committed
Add failing test
1 parent bcc2ea9 commit 9ee1a17

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script>
2+
const {log, ...restProps} = $props();
3+
</script>
4+
5+
<button onclick={() => log.push('internal!')} {...restProps}>
6+
<slot />
7+
</button>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { flushSync } from 'svelte';
2+
import { test } from '../../test';
3+
4+
export default test({
5+
html: `<button>Test</button>`,
6+
7+
async test({ assert, target, component }) {
8+
const [b1] = target.querySelectorAll('button');
9+
10+
flushSync(() => {
11+
b1?.click();
12+
});
13+
14+
assert.deepEqual(component.log, ['external!']);
15+
}
16+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<script>
2+
import Button from "./Button.svelte";
3+
4+
const {log = []} = $props();
5+
</script>
6+
7+
<Button log={log} onclick={() => log.push('external!')}>Test</Button>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
2-
const {log, ...restProps} = $props();
2+
const {log, children, ...restProps} = $props();
33
</script>
44

55
<button onclick={() => log.push('internal!')} {...restProps}>
6-
<slot />
6+
{@render children()}
77
</button>

0 commit comments

Comments
 (0)