mirror of https://github.com/sveltejs/svelte
parent
c42bb04276
commit
426792492a
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: deconflict multiple snippets of the same name
|
@ -0,0 +1,24 @@
|
||||
import { flushSync } from 'svelte';
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
mode: ['client'],
|
||||
|
||||
test({ assert, target }) {
|
||||
const btn = target.querySelector('button');
|
||||
|
||||
btn?.click();
|
||||
btn?.click();
|
||||
btn?.click();
|
||||
flushSync();
|
||||
|
||||
assert.htmlEqual(
|
||||
target.innerHTML,
|
||||
`
|
||||
<button>push</button><div style="display: grid; grid-template-columns: 1fr 1fr"><div><p style="color: red">1</p><p style="color: red">2</p><p style="color: red">3</p>
|
||||
<p style="color: red">4</p><p style="color: red">5</p><p style="color: red">6</p></div><div><p style="color: blue">1</p><p style="color: blue">2</p><p style="color: blue">3</p>
|
||||
<p style="color: blue">4</p><p style="color: blue">5</p><p style="color: blue">6</p></div></div>
|
||||
`
|
||||
);
|
||||
}
|
||||
});
|
@ -0,0 +1,29 @@
|
||||
<script>
|
||||
let numbers = $state([1, 2, 3]);
|
||||
</script>
|
||||
|
||||
<button onclick={() => numbers.push(numbers.length + 1)}>
|
||||
push
|
||||
</button>
|
||||
|
||||
<div style="display: grid; grid-template-columns: 1fr 1fr">
|
||||
<div>
|
||||
{#snippet x(n)}
|
||||
<p style="color: red">{n}</p>
|
||||
{/snippet}
|
||||
|
||||
{#each numbers as n}
|
||||
{@render x(n)}
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{#snippet x(n)}
|
||||
<p style="color: blue">{n}</p>
|
||||
{/snippet}
|
||||
|
||||
{#each numbers as n}
|
||||
{@render x(n)}
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in new issue