Skip to content

Commit a85e1a1

Browse files
committed
test
1 parent 2bbebb6 commit a85e1a1

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { flushSync } from 'svelte';
2+
import { test } from '../../test';
3+
4+
// https://github.com/sveltejs/svelte/issues/15368
5+
export default test({
6+
compileOptions: {
7+
dev: true
8+
},
9+
10+
mode: ['client'],
11+
12+
html: `
13+
<p>BOOM</p>
14+
<p>BOOM</p>
15+
<div>OK</div>
16+
<div>OK</div>
17+
`,
18+
19+
async test({ target, assert, component }) {
20+
component.ok = false;
21+
flushSync();
22+
23+
assert.htmlEqual(
24+
target.innerHTML,
25+
`
26+
<p>BOOM</p>
27+
<p>BOOM</p>
28+
<p>BOOM</p>
29+
<p>BOOM</p>
30+
`
31+
);
32+
}
33+
});
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<script>
2+
let { ok = true } = $props();
3+
4+
function throwError() {
5+
throw new Error();
6+
}
7+
8+
function throwErrorOnUpdate() {
9+
if (ok) {
10+
return "OK";
11+
} else {
12+
fail();
13+
}
14+
}
15+
</script>
16+
17+
<svelte:boundary>
18+
<div>{throwError()}</div>
19+
20+
{#snippet failed()}
21+
<p>BOOM</p>
22+
{/snippet}
23+
</svelte:boundary>
24+
25+
<svelte:boundary>
26+
{@const result = throwError()}
27+
<div>{result}</div>
28+
29+
{#snippet failed()}
30+
<p>BOOM</p>
31+
{/snippet}
32+
</svelte:boundary>
33+
34+
<svelte:boundary>
35+
<div>{throwErrorOnUpdate()}</div>
36+
37+
{#snippet failed()}
38+
<p>BOOM</p>
39+
{/snippet}
40+
</svelte:boundary>
41+
42+
<svelte:boundary>
43+
{@const result = throwErrorOnUpdate()}
44+
<div>{result}</div>
45+
46+
{#snippet failed()}
47+
<p>BOOM</p>
48+
{/snippet}
49+
</svelte:boundary>

0 commit comments

Comments
 (0)