pull/16444/head
Rich Harris 2 months ago
parent c8f979be71
commit 6564171e42

@ -0,0 +1,13 @@
<script>
let count = $state(1);
let { squared, cubed } = $derived(await {
squared: count ** 2,
cubed: count ** 3
});
</script>
<button onclick={() => count++}>increment</button>
<p>{count} ** 2 = {squared}</p>
<p>{count} ** 3 = {cubed}</p>

@ -0,0 +1,31 @@
import { tick } from 'svelte';
import { test } from '../../test';
export default test({
async test({ assert, target }) {
await tick();
const [increment] = target.querySelectorAll('button');
assert.htmlEqual(
target.innerHTML,
`
<button>increment</button>
<p>1 ** 2 = 1</p>
<p>1 ** 3 = 1</p>
`
);
increment.click();
await tick();
assert.htmlEqual(
target.innerHTML,
`
<button>increment</button>
<p>2 ** 2 = 4</p>
<p>2 ** 3 = 8</p>
`
);
}
});

@ -0,0 +1,11 @@
<script>
import Child from './Child.svelte';
</script>
<svelte:boundary>
<Child />
{#snippet pending()}
<p>pending</p>
{/snippet}
</svelte:boundary>
Loading…
Cancel
Save