include parent component in test scenario

pull/2752/head
Colin Casey 6 years ago
parent 59c4b76383
commit 5dc3528305

@ -1,6 +1,5 @@
<script>
import { onMount, beforeUpdate, afterUpdate } from 'svelte';
import order from './order.js';
export let index;

@ -5,6 +5,8 @@ export default {
test({ assert, component, target }) {
assert.deepEqual(order, [
'0: beforeUpdate',
'0: render',
'1: beforeUpdate',
'1: render',
'2: beforeUpdate',
@ -16,7 +18,9 @@ export default {
'2: afterUpdate',
'2: onMount',
'3: afterUpdate',
'3: onMount'
'3: onMount',
'0: afterUpdate',
'0: onMount',
]);
order.length = 0;

@ -1,7 +1,29 @@
<script>
import { onMount, beforeUpdate, afterUpdate } from 'svelte';
import order from './order.js';
import Item from './Item.svelte';
const parentIndex = 0;
function logRender () {
order.push(`${parentIndex}: render`);
return parentIndex;
}
beforeUpdate(() => {
order.push(`${parentIndex}: beforeUpdate`);
});
afterUpdate(() => {
order.push(`${parentIndex}: afterUpdate`);
});
onMount(() => {
order.push(`${parentIndex}: onMount`);
})
</script>
{logRender()}
<ul>
{#each [1,2,3] as index}
<Item {index} />

Loading…
Cancel
Save