pull/16449/head
Rich Harris 2 months ago
parent bf9d999a9b
commit 507d577c48

@ -0,0 +1,7 @@
<script>
let { object } = $props();
await 1;
</script>
<button onclick={() => object.count++}>clicks: {object.count}</button>

@ -0,0 +1,22 @@
import { tick } from 'svelte';
import { test } from '../../test';
export default test({
compileOptions: {
dev: true
},
async test({ assert, target, warnings }) {
await tick();
const [button] = target.querySelectorAll('button');
button.click();
await tick();
assert.htmlEqual(target.innerHTML, '<button>clicks: 1</button>');
assert.deepEqual(warnings, [
'Mutating unbound props (`object`, at Child.svelte:7:23) is strongly discouraged. Consider using `bind:object={...}` in main.svelte (or using a callback) instead'
]);
}
});

@ -0,0 +1,13 @@
<script>
import Child from './Child.svelte';
let object = $state({ count: 0 });
</script>
<svelte:boundary>
<Child {object} />
{#snippet pending()}
<p>loading...</p>
{/snippet}
</svelte:boundary>
Loading…
Cancel
Save