mirror of https://github.com/sveltejs/svelte
Fix each blocks not unmounting components correctly (#3056)
* Prevent outro from invoking detach multiple times * Add tests for unmounting entries in an each block * Remove redundant function for removing from lookuppull/3062/head
parent
f9054bc439
commit
7b5f176764
@ -0,0 +1,5 @@
|
||||
<script>
|
||||
export let title;
|
||||
</script>
|
||||
|
||||
<p>{title}</p>
|
@ -0,0 +1,27 @@
|
||||
export default {
|
||||
props: {
|
||||
titles: [{ name: 'a', }, { name: 'b' }, { name: 'c' }]
|
||||
},
|
||||
|
||||
html: `
|
||||
<p>a</p>
|
||||
<p>b</p>
|
||||
<p>c</p>
|
||||
`,
|
||||
|
||||
test({ assert, component, target }) {
|
||||
component.titles = [{ name: 'b' }, { name: 'c' }];
|
||||
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<p>b</p>
|
||||
<p>c</p>
|
||||
`);
|
||||
|
||||
component.titles = [{ name: 'c' }];
|
||||
|
||||
assert.htmlEqual(target.innerHTML, `
|
||||
<p>c</p>
|
||||
`);
|
||||
|
||||
}
|
||||
};
|
@ -0,0 +1,9 @@
|
||||
<script>
|
||||
import Nested from './Nested.svelte';
|
||||
|
||||
export let titles;
|
||||
</script>
|
||||
|
||||
{#each titles as title (title.name)}
|
||||
<Nested title="{title.name}"/>
|
||||
{/each}
|
Loading…
Reference in new issue