File tree Expand file tree Collapse file tree 2 files changed +82
-0
lines changed
packages/svelte/tests/runtime-runes/samples/svelte-boundary-dev-const Expand file tree Collapse file tree 2 files changed +82
-0
lines changed Original file line number Diff line number Diff line change 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+ } ) ;
Original file line number Diff line number Diff line change 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 >
You can’t perform that action at this time.
0 commit comments