mirror of https://github.com/sveltejs/svelte
parent
b7625fd42c
commit
1c02dc243f
@ -0,0 +1,6 @@
|
||||
<script>
|
||||
let { double } = $props();
|
||||
double; // forces derived into UNOWNED mode
|
||||
</script>
|
||||
|
||||
<p>{double}</p>
|
||||
@ -0,0 +1,30 @@
|
||||
import { tick } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
async test({ assert, target }) {
|
||||
const button = target.querySelector('button');
|
||||
|
||||
button?.click();
|
||||
await tick();
|
||||
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<button>1</button>
|
||||
<p>2</p>
|
||||
`
|
||||
);
|
||||
|
||||
button?.click();
|
||||
await tick();
|
||||
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<button>2</button>
|
||||
<p>4</p>
|
||||
`
|
||||
);
|
||||
}
|
||||
});
|
||||
@ -0,0 +1,19 @@
|
||||
<script>
|
||||
import Component from './Component.svelte';
|
||||
let count = $state(0);
|
||||
const double = $derived(count * 2);
|
||||
</script>
|
||||
|
||||
<svelte:boundary>
|
||||
{await new Promise((r) => {
|
||||
// long enough for the test to do all its other stuff while this is pending
|
||||
setTimeout(r, 10);
|
||||
})}
|
||||
{#snippet pending()}{/snippet}
|
||||
</svelte:boundary>
|
||||
|
||||
<button onclick={() => count += 1}>{count}</button>
|
||||
|
||||
{#if count > 0}
|
||||
<Component {double} />
|
||||
{/if}
|
||||
Loading…
Reference in new issue