-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1426a6d
commit 8a28f72
Showing
6 changed files
with
92 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
packages/svelte/tests/runtime-runes/samples/async-svelte-element/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { flushSync, tick } from 'svelte'; | ||
import { deferred } from '../../../../src/internal/shared/utils.js'; | ||
import { test } from '../../test'; | ||
|
||
/** @type {ReturnType<typeof deferred>} */ | ||
let d; | ||
|
||
export default test({ | ||
html: `<p>pending</p>`, | ||
|
||
get props() { | ||
d = deferred(); | ||
|
||
return { | ||
promise: d.promise | ||
}; | ||
}, | ||
|
||
async test({ assert, target, component }) { | ||
d.resolve('h1'); | ||
await Promise.resolve(); | ||
await Promise.resolve(); | ||
await tick(); | ||
flushSync(); | ||
assert.htmlEqual(target.innerHTML, '<h1>hello</h1>'); | ||
|
||
component.promise = (d = deferred()).promise; | ||
await tick(); | ||
assert.htmlEqual(target.innerHTML, '<p>pending</p>'); | ||
|
||
d.resolve('h2'); | ||
await tick(); | ||
assert.htmlEqual(target.innerHTML, '<h2>hello</h2>'); | ||
} | ||
}); |
11 changes: 11 additions & 0 deletions
11
packages/svelte/tests/runtime-runes/samples/async-svelte-element/main.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script> | ||
let { promise } = $props(); | ||
</script> | ||
|
||
<svelte:boundary> | ||
<svelte:element this={await promise}>hello</svelte:element> | ||
|
||
{#snippet pending()} | ||
<p>pending</p> | ||
{/snippet} | ||
</svelte:boundary> |