mirror of https://github.com/sveltejs/svelte
parent
d3949a6e71
commit
7d19e5b1a4
@ -0,0 +1,5 @@
|
||||
---
|
||||
"svelte": patch
|
||||
---
|
||||
|
||||
fix: disallow mounting a snippet
|
@ -0,0 +1,12 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
compileOptions: {
|
||||
dev: true
|
||||
},
|
||||
async test({ assert, target }) {
|
||||
const div = target.querySelector('div');
|
||||
assert.htmlEqual(div?.innerHTML || '', '');
|
||||
},
|
||||
runtime_error: 'snippet_used_as_component\nA snippet must be rendered with `{@render ...}`'
|
||||
});
|
@ -0,0 +1,14 @@
|
||||
<script>
|
||||
import { onMount, mount } from 'svelte';
|
||||
|
||||
let el;
|
||||
|
||||
onMount(() => {
|
||||
mount(foo, { target: el });
|
||||
});
|
||||
</script>
|
||||
|
||||
<div bind:this={el}></div>
|
||||
{#snippet foo()}
|
||||
shouldnt be rendered
|
||||
{/snippet}
|
Loading…
Reference in new issue