mirror of https://github.com/sveltejs/svelte
Fixes #1624 ensuring that * blocks that use "current" include outros that set it to false * when a block is moved inside a keyed each block, call outro before intro againpull/1729/head
parent
a4d412fb53
commit
2aba4335b0
@ -0,0 +1 @@
|
|||||||
|
<p><slot></slot></p>
|
@ -0,0 +1,41 @@
|
|||||||
|
export default {
|
||||||
|
data: {
|
||||||
|
todos: [
|
||||||
|
{ id: 123, description: 'one' },
|
||||||
|
{ id: 234, description: 'two' },
|
||||||
|
{ id: 345, description: 'three' },
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
html: `
|
||||||
|
<p>1: one</p>
|
||||||
|
<p>2: two</p>
|
||||||
|
<p>3: three</p>
|
||||||
|
`,
|
||||||
|
|
||||||
|
nestedTransitions: true,
|
||||||
|
|
||||||
|
test(assert, component, target) {
|
||||||
|
const { todos } = component.get();
|
||||||
|
|
||||||
|
const [p1, p2, p3] = target.querySelectorAll('p');
|
||||||
|
|
||||||
|
component.set({
|
||||||
|
todos: todos.reverse()
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<p>1: three</p>
|
||||||
|
<p>2: two</p>
|
||||||
|
<p>3: one</p>
|
||||||
|
`);
|
||||||
|
|
||||||
|
const [p4, p5, p6] = target.querySelectorAll('p');
|
||||||
|
|
||||||
|
assert.equal(p1, p6);
|
||||||
|
assert.equal(p2, p5);
|
||||||
|
assert.equal(p3, p4);
|
||||||
|
|
||||||
|
component.destroy();
|
||||||
|
}
|
||||||
|
};
|
@ -0,0 +1,10 @@
|
|||||||
|
{#each todos as todo, i (todo.id)}
|
||||||
|
<Todo>{i+1}: {todo.description}</Todo>
|
||||||
|
{/each}
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
Todo: './Todo.html'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
@ -0,0 +1 @@
|
|||||||
|
<div>{thing}</div>
|
@ -0,0 +1,23 @@
|
|||||||
|
export default {
|
||||||
|
nestedTransitions: true,
|
||||||
|
|
||||||
|
data: {
|
||||||
|
things: ['a', 'b', 'c']
|
||||||
|
},
|
||||||
|
|
||||||
|
test(assert, component, target, window, raf) {
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<div>a</div>
|
||||||
|
<div>b</div>
|
||||||
|
<div>c</div>
|
||||||
|
`);
|
||||||
|
|
||||||
|
component.set({ things: ['b', 'c', 'a'] });
|
||||||
|
|
||||||
|
assert.htmlEqual(target.innerHTML, `
|
||||||
|
<div>b</div>
|
||||||
|
<div>c</div>
|
||||||
|
<div>a</div>
|
||||||
|
`);
|
||||||
|
},
|
||||||
|
};
|
@ -0,0 +1,9 @@
|
|||||||
|
{#each things as thing (thing)}
|
||||||
|
<Widget :thing/>
|
||||||
|
{/each}
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
components: { Widget: './Widget.html' }
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in new issue