Skip to content

Commit 26f46ba

Browse files
committed
test
1 parent b8893f9 commit 26f46ba

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import { tick } from 'svelte';
2+
import { test } from '../../test';
3+
4+
export default test({
5+
async test({ assert, target }) {
6+
await tick();
7+
8+
const [increment] = target.querySelectorAll('button');
9+
10+
increment.click();
11+
await tick();
12+
assert.htmlEqual(
13+
target.innerHTML,
14+
`
15+
<button>increment</button>
16+
<p>1</p>
17+
<p>1</p>
18+
`
19+
);
20+
21+
increment.click();
22+
await tick();
23+
assert.htmlEqual(
24+
target.innerHTML,
25+
`
26+
<button>increment</button>
27+
<p>2</p>
28+
<p>2</p>
29+
`
30+
);
31+
}
32+
});
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<script lang="ts">
2+
let data = $state(Promise.resolve(0));
3+
4+
let count = $state(0);
5+
let unrelated = $state(0);
6+
7+
$effect(() => {
8+
data = Promise.resolve(count)
9+
unrelated = count;
10+
});
11+
</script>
12+
13+
<svelte:boundary>
14+
<button onclick={() => count += 1}>increment</button>
15+
<p>{JSON.stringify((await data), null, 2)}</p>
16+
{#if true}
17+
<!-- inside if block to force it into a different render effect -->
18+
<p>{unrelated}</p>
19+
{/if}
20+
21+
{#snippet pending()}
22+
<p>loading...</p>
23+
{/snippet}
24+
</svelte:boundary>

0 commit comments

Comments
 (0)