Skip to content

Commit 63f2800

Browse files
committed
test
1 parent 7a5fd29 commit 63f2800

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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 [a, b, update] = target.querySelectorAll('button');
9+
10+
assert.htmlEqual(
11+
target.innerHTML,
12+
`
13+
<button>a</button>
14+
<button>b</button>
15+
<button>0</button>
16+
<h1>a</h1>
17+
`
18+
);
19+
20+
b.click();
21+
await tick();
22+
assert.htmlEqual(
23+
target.innerHTML,
24+
`
25+
<button>a</button>
26+
<button>b</button>
27+
<button>0</button>
28+
<h1>b</h1>
29+
`
30+
);
31+
32+
update.click();
33+
await tick();
34+
assert.htmlEqual(
35+
target.innerHTML,
36+
`
37+
<button>a</button>
38+
<button>b</button>
39+
<button>1</button>
40+
<h1>b</h1>
41+
`
42+
);
43+
44+
a.click();
45+
await tick();
46+
assert.htmlEqual(
47+
target.innerHTML,
48+
`
49+
<button>a</button>
50+
<button>b</button>
51+
<button>1</button>
52+
<h1>a</h1>
53+
`
54+
);
55+
}
56+
});
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<script>
2+
let object = $state(null);
3+
let count = $state(0);
4+
5+
const condition = $derived(object === null);
6+
</script>
7+
8+
<svelte:boundary>
9+
<button onclick={() => (object = null)}>a</button>
10+
<button onclick={() => (object = {})}>b</button>
11+
12+
<button onclick={async () => {
13+
count++;
14+
await Promise.resolve();
15+
object = {};
16+
}}>{await count}</button>
17+
18+
{#if condition}
19+
<h1>a</h1>
20+
{:else}
21+
<h1>b</h1>
22+
{/if}
23+
24+
{#snippet pending()}{/snippet}
25+
</svelte:boundary>
26+

0 commit comments

Comments
 (0)