Skip to content

add a test for #8459 #8461

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions test/runtime/samples/await-no-extra-unmount/Component.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script>
import { onMount } from 'svelte';
export let mounts;
onMount(() => { ++mounts });
</script>

This component has been mounted {mounts} times.
6 changes: 6 additions & 0 deletions test/runtime/samples/await-no-extra-unmount/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default {
async test({ assert, target }) {
await new Promise(f => setTimeout(f, 0));
assert.htmlEqual(target.innerHTML, 'This component has been mounted 1 times.');
}
};
14 changes: 14 additions & 0 deletions test/runtime/samples/await-no-extra-unmount/main.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script>
import Component from "./Component.svelte";
let mounts = 0;
let promise = Promise.resolve();

(async () => {
await Promise.resolve();
promise = Promise.resolve();
})();
</script>

{#await promise then _}
<Component bind:mounts />
{/await}